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. |
||
|---|---|---|
| .. | ||
| Redis | ||
| Redis.hs | ||