Safe Haskell | Safe-Infered |
---|
This module provides the generic interface to the various typed session implementations, including both server-side and client-side typed sessions.
- class HasTypedSession v t | v -> t where
- getSession :: Handler b v t
- setSession :: t -> Handler b v ()
- clearSession :: Handler b v ()
- touchSession :: Handler b v ()
- withSession :: HasTypedSession v t => (t -> Handler b v a) -> Handler b v a
- getFromSession :: (Ord k, HasTypedSession v (Map k a)) => k -> Handler b v (Maybe a)
- setInSession :: (Ord k, HasTypedSession v (Map k a)) => k -> a -> Handler b v ()
- deleteFromSession :: (Ord k, HasTypedSession v (Map k a)) => k -> Handler b v ()
Documentation
class HasTypedSession v t | v -> t whereSource
The generic interface to typed session implementations. Both the client-side and server-side implementations of sessions implement the common interface specified here.
getSession :: Handler b v tSource
Retrieves the session for the current request, always creating it if necessary.
setSession :: t -> Handler b v ()Source
Stores a new value for the current session.
clearSession :: Handler b v ()Source
Completely clears the current session, removing all associated cookies and server-side storage if applicable.
touchSession :: Handler b v ()Source
Marks a session as recently used, resetting the session timeout counter.
HasTypedSession (MemorySessionManager t) t | |
Serialize t => HasTypedSession (ClientSessionManager t) t |
withSession :: HasTypedSession v t => (t -> Handler b v a) -> Handler b v aSource
A convenience function for gaining access to the session. The
session is touched and then passed to the nested Handler
.
getFromSession :: (Ord k, HasTypedSession v (Map k a)) => k -> Handler b v (Maybe a)Source
Gets a named value from a session that happens to be a Map
.
setInSession :: (Ord k, HasTypedSession v (Map k a)) => k -> a -> Handler b v ()Source
Sets a named value in a session that happens to be a Map
.
deleteFromSession :: (Ord k, HasTypedSession v (Map k a)) => k -> Handler b v ()Source
Deletes a named value from a session that happens to be a Map
.