diff --git a/src/aging_session/memory.clj b/src/aging_session/memory.clj index 3ccc900..97e5397 100644 --- a/src/aging_session/memory.clj +++ b/src/aging_session/memory.clj @@ -59,7 +59,7 @@ (swap! session-map sweep-entry event-fns key) (when (and refresh-on-read (contains? @session-map key)) (swap! session-map assoc-in [key :timestamp] (now))) - (get-in @session-map [key :value] {})) + (get-in @session-map [key :value])) (write-session [_ key data] (let [key (or key (str (UUID/randomUUID)))] diff --git a/test/aging_session/event_test.clj b/test/aging_session/event_test.clj index 25af007..3881ef8 100644 --- a/test/aging_session/event_test.clj +++ b/test/aging_session/event_test.clj @@ -10,7 +10,7 @@ (let [as (aging-memory-store :events [(event/expires-after 1)])] (write-session as "mykey" {:foo 1}) (. Thread (sleep 1500)) - (is (= (read-session as "mykey") {}))))) + (is (nil? (read-session as "mykey")))))) (deftest session-expiry-by-sweep (testing "Test session expiry sweep." @@ -43,6 +43,6 @@ :refresh-on-read true :sweep-every 1 :sweep-delay 1000)] - (is (= (read-session as "foo") {})) + (is (nil? (read-session as "foo"))) ; read again to trigger the sweep - (is (= (read-session as "foo") {}))))) + (is (nil? (read-session as "foo")))))) diff --git a/test/aging_session/memory_test.clj b/test/aging_session/memory_test.clj index 7740ad3..1d519cd 100644 --- a/test/aging_session/memory_test.clj +++ b/test/aging_session/memory_test.clj @@ -7,7 +7,7 @@ (deftest basic-read-empty (testing "Test session reads." (let [as (aging-memory-store)] - (is (= (read-session as "mykey") {}))))) + (is (nil? (read-session as "mykey")))))) (deftest basic-write (testing "Test session writes and reads." @@ -22,7 +22,7 @@ (let [as (aging-memory-store)] (write-session as "mykey" {:a 1}) (delete-session as "mykey") - (is (= (read-session as "mykey") {}))))) + (is (nil? (read-session as "mykey")))))) (deftest timestamp-on-creation (testing "Test the behaviour where each entry's timestamp is set only on session creation."