Created
July 10, 2010 06:25
-
-
Save afeinberg/470494 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def *factory* (voldemort/store-client-factory | |
| ["tcp://localhost:6666"])) | |
| (def *client-person* (.getStoreClient *factory* "person")) | |
| (def *client-zipcode* (.getStoreClient *factory* "zipcode")) | |
| (defn hello-voldemort [] | |
| (.put *client-person* "alex.feinberg" { "first" "alex", | |
| "last" "feinberg", | |
| "zipcode" 94041 }) | |
| (.put *client-zipcode* (get (.getValue (.get *client-person* "alex.feinberg")) | |
| "zipcode") | |
| ["alex.feinberg"]) | |
| (.put *client-person* "bradford.cross" { "first" "bradford", | |
| "last" "cross", | |
| "zipcode" 94041 }) | |
| (voldemort/apply-update | |
| *client-zipcode* | |
| (fn [client] | |
| (let [obj (.get client 94041) | |
| val (.getValue obj)] | |
| (.put client 94041 | |
| (doto obj | |
| (.setObject (cons | |
| "bradford.cross" | |
| val))))))) | |
| (doseq [[_ person-versioned] (.getAll *client-person* | |
| (.getValue (.get *client-zipcode* | |
| 94041)))] | |
| (println (get (.getValue person-versioned) | |
| "first") | |
| "lives in 94041"))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment