It sounds like maybe you've already solved your problem, Shoeb, but
just in case:

The book _Clojure in Action_ has a section on data mapping and data
persistence using Redis. You can download the source code here:
http://www.manning.com/rathore/source-code.zip

(The relevant files are chapter12_redis_datamapper.clj and
chapter12_redis_persistence.clj)

M

On Thu, Jan 5, 2012 at 11:32 AM, Shoeb Bhinderwala
<shoeb.bhinderw...@gmail.com> wrote:
> Hi Peter -
> I looked at deep-freeze but did not quite understand how to use it.
> I used the following to freeze my Clojure complex data structure -
> results (map of list of maps) and persist to redis:
>       (redis/hmset k k (deep-freeze/freeze-to-array results))
> Then I tried to retrieve and thaw it as follows:
>       (deep-freeze/thaw-from-array (redis/hget k k))
> The thaw gives me the following exception:
>    java.lang.String cannot be cast to [B - (class
> java.lang.ClassCastException)
> What am I doing wrong?
> ThanksShoeb
>
> On Jan 4, 10:55 am, Peter Taoussanis <ptaoussa...@gmail.com> wrote:
>> read/pr-str works well, but it's painfully slow relative to something
>> likeRedis. JSON libraries and the like would be faster, but might
>> require more contortions if you're using lots of Clojure data types.
>> My 2c: the best overall compromise atm is the Deep-Freeze
>> serialization library (https://github.com/halgari/deep-freeze). It
>> gets you very decent performance and great support for Clojure data
>> types.
>>
>> You don't mention whatRedisclient you're using, but be aware that if
>> you're going to be going the binary serialization route, you'll want
>> to communicate withRedisvia byte[]s rather than JVM strings. If
>> you're using Jedis, take a look at BinaryJedis.
>>
>> Hope that helps!
>>
>> --Peter
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to