amelinium.proto.session
added in 1.0.0
amelinium service, session protocols.
Sessionable
protocol
This protocol is used to access session data.
members
control
(control src)
(control src session-key)
Returns a session control object (satisfying the SessionControl
protocol) used to reach session configuration and internal operations.
empty?
(empty? src)
(empty? src session-key)
Returns false
is src
contains a session or is a session, and the session has usable identifier set (:id
or :err-id
field is set) or has the :error
field set. Optional session-key
can be given to express a key in associative structure (defaults to :session
).
inject
(inject dst smap)
(inject dst smap session-key)
Returns an object updated with session record of type Session
under an optional session-key
if session is to be put into an associative structure (defaults to :session
).
session
(session src)
(session src session-key)
Returns a session record of type Session
on a basis of configuration source provided and an optional session-key
if session must be looked in an associative structure (defaults to :session
).
SessionControl
protocol
This protocol promises access to session configuration data and basic actions which are configuration-dependent. The operations should keep access to settings and/or dynamically generated functions using lexical closures. Therefore, this protocol should later be reified, after settings are parsed, and the anonymous object with implementations should be stored in all created Session
records, in their :control
fields.
members
config
(config c)
(config c s-k)
Gets a session configuration settings.
control?
(control? c)
(control? c s-k)
Returns true
if the given object is an instance of a class implementing SessionControl
protocol (directly or indirectly).
del-session
(del-session c db-sid)
(del-session c)
Deletes a session from a persistent storage.
del-sessions
(del-sessions c uid)
(del-sessions c)
Deletes all user’s sessions from a persistent storage.
del-svars
(del-svars c db-sid)
(del-svars c)
Deletes all session variables from a persistent storage.
del-uvars
(del-uvars c uid)
(del-uvars c)
Deletes all user’s session variables from a persistent storage.
del-var
(del-var c db-sid k)
(del-var c k)
Deletes session variable from a persistent storage.
del-vars
(del-vars c db-sid ks)
(del-vars c ks)
Deletes session variables from a persistent storage.
empty
(empty c)
(empty c s-k)
Returns an empty session with the :control
field populated.
expired?
(expired? c)
(expired? c t)
Returns true
if expiration time was exceeded for t
.
from-db
(from-db c db-sid ip)
(from-db c db-sid)
(from-db c)
Gets the session data from a database.
get-active
(get-active c db-sid ip)
(get-active c db-sid)
(get-active c)
Gets the session last active time from a database.
get-var
(get-var c db-sid k)
(get-var c k)
Gets session variable from a persistent storage.
get-vars
(get-vars c db-sid ks)
(get-vars c ks)
Gets session variables from a persistent storage.
handle
(handle c sid db-sid ip)
(handle c sid ip)
(handle c sid)
(handle c)
Obtains a session from a database and creates its object.
hard-expired?
(hard-expired? c)
(hard-expired? c t)
Returns true
if hard-expiration time was exceeded for t
.
identify
(identify c req)
(identify c)
Extracts session ID.
invalidate
(invalidate c db-sid ip)
(invalidate c db-sid)
(invalidate c)
Invalidates internal cache.
mem-atom
(mem-atom c)
Returns an Atom object keeping reference to a cache object associated with memoized session handler.
mem-cache
(mem-cache c)
Returns a cache object associated with memoized session handler.
mem-handler
(mem-handler c)
(mem-handler c s-k)
Returns memoized handler function used by handle
.
put-var
(put-var c db-sid k v)
(put-var c k v)
Puts session variable into a persistent storage.
put-vars
(put-vars c db-sid kvs)
(put-vars c kvs)
Puts session variables into a persistent storage.
set-active
(set-active c db-sid ip t)
(set-active c db-sid ip)
(set-active s ip)
(set-active s)
Sets the session last active time in a database.
to-db
(to-db c smap)
Puts the session data into a database.
token-ok?
(token-ok? c plain enc)
Checks if the security token is valid.