fastcgi++
|
Container for HTTP sessions. More...
#include <http.hpp>
Public Types | |
typedef std::map< SessionId, T > ::iterator | iterator |
typedef std::map< SessionId, T > ::const_iterator | const_iterator |
Public Member Functions | |
Sessions (int keepAlive_, int cleanupFrequency_) | |
Constructor takes session keep alive times and cleanup frequency. | |
void | cleanup () |
Clean out old sessions. | |
iterator | generate (const T &value_=T()) |
Generates a new session pair with a random ID value. | |
boost::posix_time::ptime | getExpiry (const_iterator it) const |
Private Attributes | |
const boost::posix_time::seconds | keepAlive |
Amount of seconds to keep sessions around for. | |
const boost::posix_time::seconds | cleanupFrequency |
How often (in seconds) the container should find old sessions and delete them. | |
boost::posix_time::ptime | cleanupTime |
The time that the next session cleanup should be done. |
Container for HTTP sessions.
In almost all ways this class behaves like an std::map. The sole addition is a mechanism for clearing out expired sessions based on a keep alive time and a frequency of deletion. The first part of the std::pair<> is a SessionId object, and the second is a object of class T (passed as the template parameter.
T | Class containing session data. |
typedef std::map<SessionId, T>::const_iterator Fastcgipp::Http::Sessions< T >::const_iterator |
typedef std::map<SessionId, T>::iterator Fastcgipp::Http::Sessions< T >::iterator |
Fastcgipp::Http::Sessions< T >::Sessions | ( | int | keepAlive_, |
int | cleanupFrequency_ | ||
) | [inline] |
void Fastcgipp::Http::Sessions< T >::cleanup | ( | ) |
Clean out old sessions.
Calling this function will clear out any expired sessions from the container. This function must be called for any cleanup to take place, however calling may not actually cause a cleanup. The amount of seconds specified in cleanupFrequency must have expired since the last cleanup for it to actually take place.
Fastcgipp::Http::Sessions< T >::iterator Fastcgipp::Http::Sessions< T >::generate | ( | const T & | value_ = T() | ) |
boost::posix_time::ptime Fastcgipp::Http::Sessions< T >::getExpiry | ( | const_iterator | it | ) | const [inline] |
Definition at line 553 of file http.hpp.
References Fastcgipp::Http::Sessions< T >::keepAlive.
const boost::posix_time::seconds Fastcgipp::Http::Sessions< T >::cleanupFrequency [private] |
boost::posix_time::ptime Fastcgipp::Http::Sessions< T >::cleanupTime [private] |
const boost::posix_time::seconds Fastcgipp::Http::Sessions< T >::keepAlive [private] |
Amount of seconds to keep sessions around for.
Definition at line 515 of file http.hpp.
Referenced by Fastcgipp::Http::Sessions< T >::getExpiry().