Commit graph

37 commits

Author SHA1 Message Date
Gered 8228408082 delete-session now also calls on-expiry when it deletes something 2022-01-04 19:20:17 -05:00
Gered 1384c52d75 on-expiry now also receives a "reason" parameter when called 2022-01-04 19:19:43 -05:00
Gered 01a7a379c6 add expiration listener support 2022-01-03 22:06:00 -05:00
Gered 1e4a98e946 fix session store init and default opts handling. how embarrassing!
cannot believe i didn't catch this earlier. whoops.
2022-01-03 21:24:14 -05:00
Gered 349dd71ce9 simplify
i think this weird assoc was a leftover artifact from the old
event-fn stuff that i removed already? either way, performing an assoc
here is entirely useless so lets get rid of it
2022-01-03 18:13:03 -05:00
Gered 334bb6b353 minor performance enhancements to read-session and write-session 2022-01-03 17:26:32 -05:00
Gered c40c663bde some refactoring that will be useful for upcoming expiry listener stuff
unfortunately this seems to hurt read-session performance slightly
2022-01-03 17:05:48 -05:00
Gered f71ca8985a rename 'memory' namespace to 'core' 2022-01-02 21:53:39 -05:00
Gered 69d5257e42 replace get-all-sessions with all-entries method added to AgingStore
seems like a slightly cleaner way to do this? maybe.
2022-01-02 21:50:34 -05:00
Gered 175cc5dca3 cleanup 2022-01-02 19:43:53 -05:00
Gered c95a02270a 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 ...
2022-01-02 19:42:55 -05:00
Gered 65870439bd better naming 2022-01-02 19:42:13 -05:00
Gered baecdaf136 keep the sweeper thread inside MemoryAgingStore. add thread stop fn
this is a change for functionality that will almost never, ever be used
in practice. but i just didn't like the idea of the 'aging-memory-store'
function creating a thread that you then had no control over whatsoever
after it returns ... maybe someone, somewhere will benefit from this.
2022-01-02 19:41:02 -05:00
Gered f6aaf5e074 update tests again 2022-01-02 18:53:16 -05:00
Gered b6f9551d0d fix not ever triggering session sweep when no sweep threshold set 2022-01-02 18:42:03 -05:00
Gered 70d301afb3 update tests 2022-01-02 18:30:21 -05:00
Gered 4b0ddab2ea allow sweeper-thread sweeping threshold to be disabled and always run
if a number is not provided, then every time the sweeper thread body
executes, it will try to sweep the entire session, even if nothing
has read/written the session store in the mean time. this is also now
the default behaviour. the thinking here is that this allows for the
best real-time-feeling behaviour with regards to session expiry,
especially for low-traffic / low-activity web apps. applications
that care more about performance, can easily set a threshold here and
get the old behaviour back.
2022-01-02 18:27:52 -05:00
Gered 71ba250f61 update defaults
i suspect that most web apps want these to be true by default. certainly
that has been the case for all the web apps that i've ever worked on
2022-01-02 18:21:18 -05:00
Gered 64a62e4a80 these functions can be private 2022-01-02 18:19:56 -05:00
Gered 2724754021 rename sweeper thread properties to be a little clearer
i guess this is all subjective though ...
2022-01-02 18:19:34 -05:00
Gered 0855450a2b update doc comments 2022-01-02 17:21:57 -05:00
Gered 1b3a988877 minor refactor 2022-01-02 17:16:35 -05:00
Gered ecf7bae62e revert the back to the previous now function calling
apparently this is a little bit faster than calling now once and then
passing it around as an argument. i have to admit i was not expecting
it to be a small but noticeable difference. i guess the JVM is really
able to optimize calls to System.currentTimeMillis() well?

of note is that there is now some possibility for very slight
discrepancies with the timestamps being set in a larger session map
across sweep-session calls (for example) because we are repeatedly
calling the 'now' function.

this is _probably_ not a big deal though.
2022-01-02 17:13:20 -05:00
Gered eb2810652e tweaks to session entry expiry checks/handling
some performance improvements here ...
2022-01-02 17:01:21 -05:00
Gered 38c6a37d59 optimization for when the session entry doesn't exist
an easy and very significant performance boost for this scenario ...
2022-01-02 16:19:34 -05:00
Gered a79fed3246 replace event functions with session expiry ttl, and tweak opts param
the events function stuff always seemed very overkill to me. i cannot
think of any other criteria i've ever wanted for session expiry other
than "expire based on some period of idle time elapsing" and an event
function being used to provide this seems a bit too much to me.

thusly, this has all been replaced with a simple ttl value (specified
in seconds) as a non-optional argument to aging-memory-store.

also change the aging-memory-store opts parameter, it must now be an
explicit map if provided
2022-01-02 15:53:43 -05:00
Gered 257c8caf10 update tests 2022-01-02 15:09:25 -05:00
Gered 1fd154c4f6 read-session should return nil when there is no value
this is to be consistent with most all other implementations of
ring's SessionStore that i've seen
2022-01-02 14:51:19 -05:00
Gered a04a74f2a8 bump to next snapshot version for future development 2021-12-29 19:43:53 -05:00
Gered 53588d6087 Version 0.1.0 2021-12-29 19:43:30 -05:00
Gered af8f18ca1e update README.md 2021-12-29 19:42:56 -05:00
Gered 3154ed7b38 add criterium benchmarks for future improvements/comparisons 2021-12-29 18:59:17 -05:00
Gered cecb626154 update README.md 2021-12-29 18:11:36 -05:00
Gered c35897b8c8 minor cleanups, mostly formatting 2021-12-29 17:54:43 -05:00
Gered 391d79837f update README.md 2021-12-29 17:50:38 -05:00
Gered e6ba631f7b update dependencies, clean up project.clj 2021-12-29 17:25:34 -05:00
Gered 6b9e11880f initial commit. forking original from tag "0.3.1" by Kira Systems
https://github.com/kirasystems/aging-session
2021-12-29 17:22:01 -05:00