Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

update-session! #42

Closed
wants to merge 1 commit into from

2 participants

@Raynes
Owner

I need this or a similar function in tryclj to do atomic updates to the session. I inlined this function in my code for now.

One thing I'm not sure about is the keys. It might be confusing for people to get and put! the session using keywords and then find out (probably the hard way) that they're actually stored as strings. Does it matter? Anyways, this is my prototype. Go forth and pull/rewrite. ;>

@ibdknox ibdknox closed this pull request from a commit
@ibdknox ibdknox jsonp response, session/swap\!, base-url. Closes #42. Closes #39. Clo…
…ses #32.

Signed-off-by: Chris Granger <ibdknox@gmail.com>
1cef731
@ibdknox ibdknox closed this in 1cef731
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 4, 2011
  1. @Raynes
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/noir/session.clj
View
5 src/noir/session.clj
@@ -10,6 +10,11 @@
(declare ^:dynamic *noir-session*)
(defonce mem (atom {}))
+(defn update-session!
+ "Swaps the session's old value with a new value obtained by applying
+ f to the old value and any args." [f & args]
+ (apply swap! *noir-session* f args))
+
(defn put!
"Associates the key with the given value in the session"
[k v]
Something went wrong with that request. Please try again.