summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-29 22:10:53 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-29 22:10:53 +0100
commit5e27541a73256258d99b134f0f5c2e277b48c3b6 (patch)
tree1f6c53c426e458dfd8aac774f19667463ba45889 /src
parent4649d37757f741dd0f76d7ab8e79105e02a2327a (diff)
Make potentially more efficient use of the data store when updating entities.
Diffstat (limited to 'src')
-rw-r--r--src/logikorr/servlet.clj15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/logikorr/servlet.clj b/src/logikorr/servlet.clj
index 754c3ec..5ade9a8 100644
--- a/src/logikorr/servlet.clj
+++ b/src/logikorr/servlet.clj
@@ -25,12 +25,15 @@
(defn ds-update
"Update the corresponding entity from the supplied map in the data store."
- [map]
- (let [datastore (DatastoreServiceFactory/getDatastoreService),
- entity (.get datastore #^Key (:key map))]
- (doseq [[key value] (dissoc map :kind :key)]
- (.setProperty entity (name key) value))
- (.put datastore entity)))
+ [& entity-maps]
+ (let [datastore (DatastoreServiceFactory/getDatastoreService)]
+ (.put datastore
+ (map (fn [entity-map]
+ (let [entity (.get datastore #^Key (:key entity-map))]
+ (doseq [[key value] (dissoc entity-map :kind :key)]
+ (.setProperty entity (name key) value))
+ entity))
+ entity-maps))))
(def *static-directory* "/Users/mulk/Dropbox/Projekte/LogiCLJ/war")