optimization for when the session entry doesn't exist
an easy and very significant performance boost for this scenario ...
This commit is contained in:
parent
a79fed3246
commit
38c6a37d59
|
@ -56,11 +56,12 @@
|
|||
|
||||
SessionStore
|
||||
(read-session [_ key]
|
||||
(let [ts (now)]
|
||||
(swap! session-map sweep-entry ts ttl key)
|
||||
(when (and refresh-on-read (contains? @session-map key))
|
||||
(swap! session-map assoc-in [key :timestamp] ts))
|
||||
(get-in @session-map [key :value])))
|
||||
(when (contains? @session-map key)
|
||||
(let [ts (now)]
|
||||
(swap! session-map sweep-entry ts ttl key)
|
||||
(when (and refresh-on-read (contains? @session-map key))
|
||||
(swap! session-map assoc-in [key :timestamp] ts))
|
||||
(get-in @session-map [key :value]))))
|
||||
|
||||
(write-session [_ key data]
|
||||
(let [key (or key (str (UUID/randomUUID)))]
|
||||
|
|
Loading…
Reference in a new issue