A thread-safe cache for object instance data. More...
#include <instanceCache.h>

Classes | |
| struct | Data |
| One cache entry. More... | |
| struct | Item |
Public Member Functions | |
| InstanceCache (const long maxSize=EQ_100MB) | |
| Construct a new instance cache. | |
| ~InstanceCache () | |
| Destruct this instance cache. | |
| bool | add (const ObjectVersion &rev, const uint32_t instanceID, Command &command, const uint32_t usage=0) |
| Add a new command to the instance cache. | |
| const Data & | operator[] (const uint32_t id) |
| Direct access to the cached instance data for the given object id. | |
| bool | release (const uint32_t id, const uint32_t count=1) |
| Release the retrieved instance data of the given object. | |
| bool | erase (const uint32_t id) |
| Erase all the data for the given object. | |
| long | getSize () const |
| void | expire (const int64_t age) |
| Remove all items which are older than the given time. | |
A thread-safe cache for object instance data.
For internal use only.
Definition at line 41 of file instanceCache.h.
| eq::net::InstanceCache::InstanceCache | ( | const long | maxSize = EQ_100MB |
) |
Construct a new instance cache.
Definition at line 46 of file instanceCache.cpp.
| eq::net::InstanceCache::~InstanceCache | ( | ) |
Destruct this instance cache.
Definition at line 51 of file instanceCache.cpp.
| bool eq::net::InstanceCache::add | ( | const ObjectVersion & | rev, | |
| const uint32_t | instanceID, | |||
| Command & | command, | |||
| const uint32_t | usage = 0 | |||
| ) |
Add a new command to the instance cache.
| rev | the object identifier and version. | |
| instanceID | the master instance ID. | |
| command | The command to add. | |
| usage | pre-set usage count. |
Definition at line 85 of file instanceCache.cpp.
References EQ_MAX, and eq::base::Clock::getTime64().

| const InstanceCache::Data & eq::net::InstanceCache::operator[] | ( | const uint32_t | id | ) |
Direct access to the cached instance data for the given object id.
The instance data for the given object has to be released by the caller, unless 0 has been returned. Not all returned data stream might be ready.
| id | the identifier of the object to look up. |
Definition at line 171 of file instanceCache.cpp.
References EQINFO, and eq::net::InstanceCache::Data::NONE.
| bool eq::net::InstanceCache::release | ( | const uint32_t | id, | |
| const uint32_t | count = 1 | |||
| ) |
Release the retrieved instance data of the given object.
| id | the identifier of the object to release. | |
| count | the number of access operations to release |
Definition at line 196 of file instanceCache.cpp.
| bool eq::net::InstanceCache::erase | ( | const uint32_t | id | ) |
Erase all the data for the given object.
The data does not have to be accessed, i.e., release has been called for each previous access.
Definition at line 212 of file instanceCache.cpp.
| long eq::net::InstanceCache::getSize | ( | ) | const [inline] |
Definition at line 108 of file instanceCache.h.
| void eq::net::InstanceCache::expire | ( | const int64_t | age | ) |
Remove all items which are older than the given time.
Definition at line 228 of file instanceCache.cpp.
References EQWARN, and eq::base::Clock::getTime64().
Referenced by eq::net::Session::expireInstanceData().


0.9.1 by
1.6.1