Malloy
Loading...
Searching...
No Matches
malloy::http::sessions::session_chrono< Clock > Struct Template Reference

#include <session.hpp>

Inheritance diagram for malloy::http::sessions::session_chrono< Clock >:
Collaboration diagram for malloy::http::sessions::session_chrono< Clock >:

Public Types

using time_point_t = std::chrono::time_point<Clock>
Public Types inherited from malloy::http::sessions::session
using key_type = std::string
using value_type = std::string
using id_type = std::string

Public Member Functions

 session_chrono (id_type &&id)
time_point_t access_time () const noexcept
template<typename Rep, typename Period>
constexpr bool access_time_older_than (const std::chrono::duration< Rep, Period > &max_lifetime) const
Public Member Functions inherited from malloy::http::sessions::session
 session (id_type &&id)
virtual ~session ()=default
 session (const session &other)=delete
 session (session &&other) noexcept=delete
session & operator= (const session &other)=delete
session & operator= (session &&other) noexcept=delete
bool set (const key_type &key, value_type value)
std::optional< key_type > get (const key_type &key)
virtual bool remove (const key_type &key)
id_type id () const noexcept
cookie generate_cookie (std::string cookie_name) const

Protected Member Functions

void update_access_time () override
Protected Member Functions inherited from malloy::http::sessions::session
virtual bool storage_set (const key_type &key, value_type value)=0
virtual std::optional< value_type > storage_get (const key_type &key) const =0
virtual bool storage_remove (const key_type &key)=0

Detailed Description

template<typename Clock>
struct malloy::http::sessions::session_chrono< Clock >

A session implementing the access time using std::chrono.

Template Parameters
ClockThe clock type to use.

Constructor & Destructor Documentation

◆ session_chrono()

template<typename Clock>
malloy::http::sessions::session_chrono< Clock >::session_chrono ( id_type && id)
inlineexplicit

Constructor.

Parameters
idThe session ID.
Here is the call graph for this function:

Member Function Documentation

◆ access_time()

template<typename Clock>
time_point_t malloy::http::sessions::session_chrono< Clock >::access_time ( ) const
inlinenoexcept

Get the access time.

Returns
The access time.

◆ access_time_older_than()

template<typename Clock>
template<typename Rep, typename Period>
bool malloy::http::sessions::session_chrono< Clock >::access_time_older_than ( const std::chrono::duration< Rep, Period > & max_lifetime) const
inlinenodiscardconstexpr

Checks whether this session's access time is older than a specified maximum lifetime.

Template Parameters
DurationThe duration type.
Parameters
durationThe ma
Returns

◆ update_access_time()

template<typename Clock>
void malloy::http::sessions::session_chrono< Clock >::update_access_time ( )
inlineoverrideprotectedvirtual

Update the access time.

This should usually update the access time to the current time.

Implements malloy::http::sessions::session.


The documentation for this struct was generated from the following file: