Skip to content

class Athena::HTTP::Session::Storage::Handler::Memory
inherits Athena::HTTP::Session::Storage::Handler::AbstractHandler #

A handler that keeps sessions in memory.

Sessions are lost when the process exits, and are not shared between processes. Mainly useful for testing.

Constructors#

.new(max_lifetime : Int32 = 1440)#

Creates a new handler whose sessions expire once they were not used for max_lifetime seconds.

View source

Methods#

#gc(max_lifetime : Int32) : Int32#

Removes the sessions that were not used in the last max_lifetime seconds. Returns how many sessions were removed.

View source

#update_timestamp(session_id : String, data : String) : Bool#

Updates when the session with the provided session_id was last used, without changing its data. Returns true if it was updated, otherwise false.

View source