ZNC  trunk
Public Member Functions | Protected Types | Protected Attributes | List of all members
CWebSessionMap Class Reference

#include <WebModules.h>

+ Inheritance diagram for CWebSessionMap:
+ Collaboration diagram for CWebSessionMap:

Public Member Functions

 CWebSessionMap (unsigned int uTTL=5000)
 
void FinishUserSessions (const CUser &User)
 
void AddItem (const CString &Item)
 This function adds an item to the cache using the default time-to-live value. More...
 
void AddItem (const CString &Item, unsigned int uTTL)
 This function adds an item to the cache using a custom time-to-live value. More...
 
void AddItem (const CString &Item, const std::shared_ptr< CWebSession > &Val)
 This function adds an item to the cache using the default time-to-live value. More...
 
void AddItem (const CString &Item, const std::shared_ptr< CWebSession > &Val, unsigned int uTTL)
 This function adds an item to the cache using a custom time-to-live value. More...
 
bool HasItem (const CString &Item)
 Performs a Cleanup() and then checks to see if your item exists. More...
 
std::shared_ptr< CWebSession > * GetItem (const CString &Item)
 Performs a Cleanup() and returns a pointer to the object, or nullptr. More...
 
bool RemItem (const CString &Item)
 Removes a specific item from the cache. More...
 
void Cleanup ()
 Cycles through the queue removing all of the stale entries. More...
 
void Clear ()
 Clear all entries. More...
 
std::map< CString, std::shared_ptr< CWebSession > > GetItems ()
 Returns all entries. More...
 
void SetTTL (unsigned int u)
 
unsigned int GetTTL () const
 

Protected Types

typedef std::pair< unsigned long long, std::shared_ptr< CWebSession > > value
 
typedef std::map< CString, value >::iterator iterator
 

Protected Attributes

std::map< CString, valuem_mItems
 Map of cached items. More...
 
unsigned int m_uTTL
 Default time-to-live duration. More...
 

Member Typedef Documentation

◆ iterator

typedef std::map<CString , value>::iterator TCacheMap< CString , std::shared_ptr< CWebSession > >::iterator
protectedinherited

◆ value

typedef std::pair<unsigned long long, std::shared_ptr< CWebSession > > TCacheMap< CString , std::shared_ptr< CWebSession > >::value
protectedinherited

Constructor & Destructor Documentation

◆ CWebSessionMap()

CWebSessionMap::CWebSessionMap ( unsigned int  uTTL = 5000)
inline

Member Function Documentation

◆ AddItem() [1/4]

void TCacheMap< CString , std::shared_ptr< CWebSession > >::AddItem ( const CString Item)
inlineinherited

This function adds an item to the cache using the default time-to-live value.

Parameters
Itemthe item to add to the cache

◆ AddItem() [2/4]

void TCacheMap< CString , std::shared_ptr< CWebSession > >::AddItem ( const CString Item,
const std::shared_ptr< CWebSession > &  Val 
)
inlineinherited

This function adds an item to the cache using the default time-to-live value.

Parameters
Itemthe item to add to the cache
ValThe value associated with the key Item

◆ AddItem() [3/4]

void TCacheMap< CString , std::shared_ptr< CWebSession > >::AddItem ( const CString Item,
const std::shared_ptr< CWebSession > &  Val,
unsigned int  uTTL 
)
inlineinherited

This function adds an item to the cache using a custom time-to-live value.

Parameters
Itemthe item to add to the cache
ValThe value associated with the key Item
uTTLthe time-to-live for this specific item

◆ AddItem() [4/4]

void TCacheMap< CString , std::shared_ptr< CWebSession > >::AddItem ( const CString Item,
unsigned int  uTTL 
)
inlineinherited

This function adds an item to the cache using a custom time-to-live value.

Parameters
Itemthe item to add to the cache
uTTLthe time-to-live for this specific item

◆ Cleanup()

void TCacheMap< CString , std::shared_ptr< CWebSession > >::Cleanup ( )
inlineinherited

Cycles through the queue removing all of the stale entries.

◆ Clear()

void TCacheMap< CString , std::shared_ptr< CWebSession > >::Clear ( )
inlineinherited

Clear all entries.

◆ FinishUserSessions()

void CWebSessionMap::FinishUserSessions ( const CUser User)

◆ GetItem()

std::shared_ptr< CWebSession > * TCacheMap< CString , std::shared_ptr< CWebSession > >::GetItem ( const CString Item)
inlineinherited

Performs a Cleanup() and returns a pointer to the object, or nullptr.

Parameters
ItemThe item to check for
Returns
Pointer to the item or nullptr if there is no suitable one

◆ GetItems()

std::map<CString , std::shared_ptr< CWebSession > > TCacheMap< CString , std::shared_ptr< CWebSession > >::GetItems ( )
inlineinherited

Returns all entries.

◆ GetTTL()

unsigned int TCacheMap< CString , std::shared_ptr< CWebSession > >::GetTTL ( ) const
inlineinherited

◆ HasItem()

bool TCacheMap< CString , std::shared_ptr< CWebSession > >::HasItem ( const CString Item)
inlineinherited

Performs a Cleanup() and then checks to see if your item exists.

Parameters
ItemThe item to check for
Returns
true if item exists

◆ RemItem()

bool TCacheMap< CString , std::shared_ptr< CWebSession > >::RemItem ( const CString Item)
inlineinherited

Removes a specific item from the cache.

Parameters
ItemThe item to be removed
Returns
true if item existed and was removed, false if it never existed

◆ SetTTL()

void TCacheMap< CString , std::shared_ptr< CWebSession > >::SetTTL ( unsigned int  u)
inlineinherited

Member Data Documentation

◆ m_mItems

std::map<CString , value> TCacheMap< CString , std::shared_ptr< CWebSession > >::m_mItems
protectedinherited

Map of cached items.

The value portion of the map is for the expire time

◆ m_uTTL

unsigned int TCacheMap< CString , std::shared_ptr< CWebSession > >::m_uTTL
protectedinherited

Default time-to-live duration.


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