Permalink
Browse files

Improved documentation for SessionStore and wrap-session

  • Loading branch information...
1 parent 0e68817 commit 9d805fe1d81505d998f16d952743662faad8a3e6 @paraseba paraseba committed with weavejester Dec 12, 2010
Showing with 14 additions and 6 deletions.
  1. +4 −3 ring-core/src/ring/middleware/session.clj
  2. +10 −3 ring-core/src/ring/middleware/session/store.clj
View
7 ring-core/src/ring/middleware/session.clj
@@ -11,9 +11,10 @@
The following options are available:
:store
- An implementation map containing :read, :write, and :delete
- keys. This determines how the session is stored. Defaults to
- in-memory storage.
+ An implementation of the SessionStore protocol in the
+ ring.middleware.session.store namespace. This determines how the
+ session is stored. Defaults to in-memory storage
+ (ring.middleware.session.store.MemoryStore).
:root
The root path of the session. Anything path above this will not
be able to see this session. Equivalent to setting the cookie's
View
13 ring-core/src/ring/middleware/session/store.clj
@@ -2,6 +2,13 @@
"Common session store objects and functions.")
(defprotocol SessionStore
- (read-session [store key] "Read a session map from the store.")
- (write-session [store key data] "Write a session map to the store.")
- (delete-session [store key] "Delete a session map from the store."))
+ (read-session [store key]
+ "Read a session map from the store. If the key is not found, an empty map
+ is returned.")
+ (write-session [store key data]
+ "Write a session map to the store. Returns the (possibly changed) key under
+ which the data was stored. If the key is nil, the session is considered
+ to be new, and a fresh key should be generated.")
+ (delete-session [store key]
+ "Delete a session map from the store, and returns the session key. If the
+ returned key is nil, the session cookie will be removed."))

0 comments on commit 9d805fe

Please sign in to comment.