|
Twitch SDK (Internal)
|
#include <cache.h>
Classes | |
| struct | CacheEntry |
Public Types | |
| typedef std::function< void(CacheEntry &entry)> | VisitorFunc |
Public Member Functions | |
| Cache () | |
| void | SetExpiryAge (uint64_t age) |
| uint32_t | GetSize () const |
| void | PurgeUnused (uint64_t olderThan) |
| void | PurgeExpired () |
| void | Clear () |
| bool | MarkEntryUsed (const KEY_TYPE &key) |
| bool | MarkEntryNeverUnused (const KEY_TYPE &key) |
| bool | MarkEntryNeverExpires (const KEY_TYPE &key) |
| bool | SetEntryExpiryTime (const KEY_TYPE &key, uint64_t time) |
| bool | ExpireEntry (const KEY_TYPE &key) |
| void | ExpireAll () |
| void | SetEntry (const KEY_TYPE &key, VALUE_TYPE data) |
| void | RemoveEntry (const KEY_TYPE &key) |
| bool | GetEntry (const KEY_TYPE &key, VALUE_TYPE &result) |
| void | GetKeys (std::vector< KEY_TYPE > &result) |
| bool | ContainsEntry (const KEY_TYPE &key) const |
| void | ForEach (VisitorFunc func) |
| bool | HasExpiredEntries () const |
| void | ForEachExpired (VisitorFunc func) |
Protected Types | |
| typedef std::unordered_map< KEY_TYPE, CacheEntry > | MapType |
Protected Attributes | |
| MapType | mCache |
| The mapping of key to the data. More... | |
| uint64_t | mExpiryAge |
| The amount of time after which entries expire. More... | |
A helper class which provides data caching. Designed to store std::shared_ptrs as value_types; when storing primitives as value_types, be aware that ForEach iterates over a copy of the cache.
|
protected |
| typedef std::function<void(CacheEntry& entry)> ttv::Cache< KEY_TYPE, VALUE_TYPE >::VisitorFunc |
|
inline |
|
inline |
Clears the cache.
|
inline |
Determines if any data is cached under the given key.
|
inline |
Expires all entries immediately.
|
inline |
Expire the entry immediately.
|
inline |
Visits each entry in the cache.
|
inline |
Visit each expired entry in the cache.
|
inline |
Retrieves the value from the cache.
|
inline |
Retrieves the set of keys for cached values.
|
inline |
Returns the number of entries in the cache.
|
inline |
|
inline |
Marks the entry as never expiring. This is reset by setting the entry again or manipulating the expiry time with other methods.
|
inline |
Marks the entry as never being unused so it will never be purged. This is reset by MarkEntryUsed().
|
inline |
Marks the entry as recently used.
|
inline |
Removes items from the cache whose expiry time has elapsed.
|
inline |
Removes items from the cache that have not been used for the given amount of time.
|
inline |
Explicitly removes the given value from the cache.
|
inline |
Caches the given value.
|
inline |
Explicitly sets the expiry time for a given cache item.
|
inline |
Sets the amount of time after which entries will expire. Modifying this while entries exist in the cache will not affect existing entries.
|
protected |
The mapping of key to the data.
|
protected |
The amount of time after which entries expire.
1.8.13