somewhat silly convenience function for reading all session entries
most apps won't need to do this, but i seem to be unlucky and work on apps that do care about this kind of thing ...
This commit is contained in:
parent
65870439bd
commit
c95a02270a
|
@ -129,3 +129,8 @@
|
|||
(if store
|
||||
(.interrupt ^Thread (.thread store))))
|
||||
|
||||
(defn get-all-sessions
|
||||
"Convenience function that returns all the session entries currently in the aging-memory-store provided."
|
||||
[^MemoryAgingStore store]
|
||||
(if store
|
||||
@(.session_atom store)))
|
||||
|
|
|
@ -225,4 +225,13 @@
|
|||
(is (not (.isAlive ^Thread (:thread as)))
|
||||
"sweeper thread is no longer alive")))
|
||||
|
||||
(deftest can-get-all-sessions
|
||||
(let [as (->basic-aging-memory-store)]
|
||||
(write-session as "a" {:foo 1})
|
||||
(write-session as "b" {:bar 2})
|
||||
(let [sessions (get-all-sessions as)]
|
||||
(is (= 2 (count sessions)))
|
||||
(is (= (get-in sessions ["a" :value]) {:foo 1}))
|
||||
(is (= (get-in sessions ["b" :value]) {:bar 2})))))
|
||||
|
||||
#_(run-tests)
|
||||
|
|
Loading…
Reference in a new issue