Re: Keeping a ref and a DB in sync

2009-04-06 Thread Brian Carper
On Apr 3, 12:42 pm, rzeze...@gmail.com rzeze...@gmail.com wrote: Brian, I imagine you are asking this in relation to your blog engine? Yep. Thanks everyone for the help and ideas. Unfortunately I do have a ton of data in a DB already so Terracotta would be a lot of work. I rewrote everything

Keeping a ref and a DB in sync

2009-04-03 Thread Brian Carper
Is there a safe way to keep the data in a Clojure ref and the data in a table in an external (e.g. mysql) database in sync, given concurrent creates/updates/deletes from within Clojure? I can't do a DB update from within a dosync because of retries. If I send-off an agent for the DB update from

Re: Keeping a ref and a DB in sync

2009-04-03 Thread Adrian Cuthbertson
Perhaps you could do the db update as an agent action and then the ref update within the agent action if it is successful - see http://groups.google.co.za/group/clojure/browse_thread/thread/d645d77a8b51f01/667e833c1ea381d7 Regards, Adrian. On Fri, Apr 3, 2009 at 11:02 AM, Brian Carper

Re: Keeping a ref and a DB in sync

2009-04-03 Thread MikeM
In case you haven't seen this thread: http://groups.google.com/group/clojure/browse_frm/thread/aa22a709501a64ac/79b1c858c6d50497?lnk=gstq=transaction+database#79b1c858c6d50497 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Keeping a ref and a DB in sync

2009-04-03 Thread Paul Stadig
I'll just throw this out there. It may not be exactly what you're looking for, but you could use a Terracotta cluster. Terracotta will persist the cluster to disk. If you have an existing database that you are working with, then this may not help, but if you are starting from scratch you may not

Re: Keeping a ref and a DB in sync

2009-04-03 Thread rzeze...@gmail.com
Brian, I imagine you are asking this in relation to your blog engine? I came up with solution, that is, if you don't mind writing the persistent data fresh every time. http://paste.lisp.org/display/77987 Basically, I added a watch to the *comment* ref, which set the *db* ref to the new state