diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2009-11-29 22:10:53 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2009-11-29 22:10:53 +0100 |
commit | 5e27541a73256258d99b134f0f5c2e277b48c3b6 (patch) | |
tree | 1f6c53c426e458dfd8aac774f19667463ba45889 | |
parent | 4649d37757f741dd0f76d7ab8e79105e02a2327a (diff) |
Make potentially more efficient use of the data store when updating entities.
-rw-r--r-- | src/logikorr/servlet.clj | 15 |
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") |