Commit Graph

13 Commits

Author SHA1 Message Date
Michael Xavier
6edd459223 Wall-werror all the things 2017-02-01 18:20:55 -08:00
Michael Xavier
d135958be5 Update comments, exercise expiration codepath
I wanted to at least ensure my change's code was excerised, even though
it makes no material difference to the allStorageTests suite.
2016-03-12 13:11:43 -08:00
Michael Xavier
7d922d1de4 Add first stab at backend auto expiry
This is for issue #7

So it would be nice if we had access to `State` because it would provide
us with `cookieExpires`, but nothing in the machinery of serversession
makes it available to backends for some reason. Also the tests seem to
indicate that the State may not be available at the time of setting up
storange engines (or may be a chicken-and-egg situation). The best
solution seemed to be to take the settings for absolute and idle timeout
that you're going to give to the state and share them.

Just as a reminder for the motivation on this: currently in
serversession's redis backend, you accumulate sessions
indefinitely. Even after they expire, they will stay in redis. The other
backends seem vulnerable to this too but its probably not nearly a big
deal in something like persistent because:

1. Storage is not as much of a premium in peristent's supported backend
compared to redis. They are primarily storing to disk.
2. Persistent's backends have good querying primitives so it is simple
to write jobs to delete old sessions.

Redis must fit all data in memory, so storage is at a premium and in
order to find old keys you'd have to issue the frowned-upon KEYS
command (or SCAN which isn't even suppored by hedis yet) and parse every
session.

This change uses redis' built in expiry mechanism and sets the
expiration every time a write operation is made to a session. Sessions
as they would naturally expire on the client side will now automatically
expire and free memory on the backend.
2016-03-11 16:54:14 -08:00
Felipe Lessa
01b277b11e New .travis.yml using stack instead of cabal-meta. 2015-12-31 15:25:41 -02:00
Felipe Lessa
0cca9cd086 Use HashMap for SessionMap.
It's a bit faster and uses a bit less memory.
2015-05-31 23:09:02 -03:00
Felipe Lessa
fcdb14e2bf More GHC 7.8 fixes: Functor constraint. 2015-05-31 15:42:10 -03:00
Felipe Lessa
d967f2b4a7 More GHC 7.8 fixes: DeriveDataTypeable, imports, (Functor m). 2015-05-31 14:53:26 -03:00
Felipe Lessa
3e33c58af0
Generalize session data (huge commit). 2015-05-31 11:07:23 -03:00
Felipe Lessa
6895fbee4f Allow Redis to store sessions with more than 512k keys. 2015-05-28 14:34:47 -03:00
Felipe Lessa
c9e080d5b8 Better time format for Redis serialization. 2015-05-28 02:44:46 -03:00
Felipe Lessa
ff6c0efaab Redis backend is all green. 2015-05-28 02:42:22 -03:00
Felipe Lessa
bdd6db9e2a Do not lose precision when serializing UTCTime to Redis. 2015-05-28 02:20:17 -03:00
Felipe Lessa
3a56d222a8
First stab at a Redis backend. 2015-05-26 02:23:33 -03:00