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
|
SessionStore
|
||||||
(read-session [_ key]
|
(read-session [_ key]
|
||||||
(let [ts (now)]
|
(when (contains? @session-map key)
|
||||||
(swap! session-map sweep-entry ts ttl key)
|
(let [ts (now)]
|
||||||
(when (and refresh-on-read (contains? @session-map key))
|
(swap! session-map sweep-entry ts ttl key)
|
||||||
(swap! session-map assoc-in [key :timestamp] ts))
|
(when (and refresh-on-read (contains? @session-map key))
|
||||||
(get-in @session-map [key :value])))
|
(swap! session-map assoc-in [key :timestamp] ts))
|
||||||
|
(get-in @session-map [key :value]))))
|
||||||
|
|
||||||
(write-session [_ key data]
|
(write-session [_ key data]
|
||||||
(let [key (or key (str (UUID/randomUUID)))]
|
(let [key (or key (str (UUID/randomUUID)))]
|
||||||
|
|
Loading…
Reference in a new issue