Thanks a lot Peter. Worked great! I did some rudimentary bench marking
for large data sets and found deep-freeze to be 10 times faster on
average compared to JSON serialization. That is really a huge
performance difference.

On Jan 6, 2:19 am, Peter Taoussanis <ptaoussa...@gmail.com> wrote:
> Oh wow, sorry- I didn't see your reply in time and for some reason
> figured you were using clj-redis.
>
> This is actually easier since (if I recall correctly) redis-clojure is
> able to write byte[]s and has an as-bytes macro for reading.
>
> So you'd want something like this (untested):
>
> (defn thaw [k]
>   (redis/with-server {:host "dev-1" :port 6379 :db 0}
>     (let [j (redis/as-bytes (redis/hget k k))]
>       (if (nil? j)
>         (do
>            (info (str "Not found in redis cache " k))
>             nil)
>         (do
>           (info (str "Thawed from redis cache " k))
>           (df/thaw-from-array j))))))
>
> (defn freeze [k results]
>   (redis/with-server {:host "dev-1" :port 6379 :db 0}
>     (redis/hmset k k (df/freeze-to-array results))))
>
> --
> 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

Reply via email to