I've been looking at using the clojure.set functions to create a
simple in-memory database cache. Basically when the app boost up, load
entire db into memory, work with it through the basic relational
algebra functions provided. Any mutations (create/update/delete) would
be wrapped in a simple function that 1) updates the cache and 2)
persists to the database in order to add the "D" to STM's "ACI". So
for example, you could have:

(defn insert-product [product]
     (dosync (alter products conj product))
     (with-connection db (transaction (insert-values XXXstuff hereXXX)))

The dosync will run the alter within an STM transaction.
The transaction will run the insert within a local resource (database)
transaction.

In Java, if you have two transactional systems, you can bridge them
with JTA. STM, however, is a different beast. Has anyone done anything
towards bridging STM and resource transactions?

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