We use Clojure's reader representation to serialize data structures as strings 
here and we
still have some Java and JRuby code around.

Previously we were using YAML (json was in it's infancy when we opted for YAML).
A real pain in the ass... Now we use a couple of protocols callable from
every where to decipher messages in an unified way crossing languages
and representations (from/to low level representations, strings or persistent 
structures).

It's faster, shorter, much more transparent, easier to debug and elegant.

Luc


> Shoeb,
> 
> What about storing it as a string? You can either use pr-str or
> data.json/generate-string.
> 
> You can then read it back using read-string or the equivalent json fn.
> 
> Regards,
> BG
> 
> On Wed, Jan 4, 2012 at 12:00 PM, Shoeb Bhinderwala
> <shoeb.bhinderw...@gmail.com> wrote:
> > I am trying to use Redis as a data structure cache for my clojure
> > application. Does anybody have experience/code/ideas that can write/
> > read a clojure complex data structure to the Redis cache.
> >
> > For example I have a list of maps as shown below:
>sing >
> > (def m1
> >  [{
> >  "total" {:end_mv_base 721470021.02M, :ret_base -2.1510871798903652,
> >           :val_added_base -15748655.52M, :adj_mv_base 758084903.7M,
> >           :beg_mv_base 740767309.10M, :pct_contrib_fx
> > 0.6974363304530005,
> >           :ccy_spot 0.49639198233447535, :pct_contrib_base
> > -2.1510871798904274,
> >           :sec_count 90, :ret_period_base -2.1523676719086393}
> >
> >   "55" {:end_mv_base 5513170.48M, :ret_base 7.038528325335092,
> >         :val_added_base 362529.33M, :adj_mv_base 5541883.033M,
> >         :beg_mv_base 5150641.15M, :pct_contrib_fx
> > 0.004896503822395695,
> >         :ccy_spot 0.004572016877500618, :pct_contrib_base
> > 0.04959174749327096,
> >         :sec_count 1, :ret_period_base 7.0385282034552965}
> >
> >   "45" {:end_mv_base 4265060.12M, :ret_base -1.1595615568738782,
> >         :val_added_base -50036.20M, :adj_mv_base 4550627.682M,
> >         :beg_mv_base 4315096.32M, :pct_contrib_fx
> > 0.0045309069298927205,
> >         :ccy_spot 0.003163500114766722, :pct_contrib_base
> > -0.00614820276001893,
> >         :sec_count 1, :ret_period_base -1.1595616030211309}
> >  }])
> >
> > How can I store the above to Redis and read it back to recreate it?
> >
> > Thanks
> > Shoeb
> >
> > --
> > 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
> 
> 
> 
> -- 
> Baishampayan Ghose
> b.ghose at gmail.com
> 
> -- 
> 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
> 
--
Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail!

-- 
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