HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GusdUT_CappedCache Class Reference

#include <UT_CappedCache.h>

+ Inheritance diagram for GusdUT_CappedCache:

Public Member Functions

 GusdUT_CappedCache (const char *name, int64 size_in_mb=32)
 
 ~GusdUT_CappedCache () override
 
template<typename Item >
UT_IntrusivePtr< const Item > Find (const UT_CappedKey &key)
 
template<typename Item , typename Creator , typename... Args>
UT_IntrusivePtr< const Item > FindOrCreate (const UT_CappedKey &key, const Creator &creator, Args &...args)
 
template<typename T >
bool FindVal (const UT_CappedKey &key)
 
template<typename T , typename Creator , typename... Args>
bool FindOrCreateVal (const UT_CappedKey &key, const Creator &creator, Args &...args)
 
template<typename MatchFn >
int64 ClearEntries (const MatchFn &matchFn)
 
- Public Member Functions inherited from UT_CappedCache
 UT_CappedCache (const char *name, int64 size_in_mb=32)
 
 ~UT_CappedCache () override
 
 UT_CappedCache (const UT_CappedCache &)=delete
 
UT_CappedCacheoperator= (const UT_CappedCache &)=delete
 
void clear ()
 Clear the cache. More...
 
exint entries () const
 Number of entries in the cache. More...
 
exint getListEntries () const
 
UT_CappedItemHandle findItem (const UT_CappedKey &key)
 Find an item in the cache. More...
 
UT_CappedItemHandle addItem (const UT_CappedKey &key, const UT_CappedItemHandle &item)
 
void deleteItem (const UT_CappedKey &key)
 Remove an item from the cache. More...
 
template<typename T >
void threadSafeTraversal (T &task)
 
const char * utGetCacheName () const override
 
bool utHasMaxSize () const override
 
int64 utGetCurrentSize () const override
 
int64 utGetMaxSize () const override
 
void utSetMaxSize (int64 bytes) override
 
int64 utReduceCacheSizeBy (int64 bytes) override
 
- Public Member Functions inherited from UT_Cache
 UT_Cache ()
 
virtual ~UT_Cache ()
 
 UT_Cache (const UT_Cache &)=delete
 
UT_Cacheoperator= (const UT_Cache &)=delete
 
void utClearCache ()
 
virtual bool utHasMinSize () const
 
virtual int64 utGetMinSize () const
 
virtual void utSetMinSize (int64)
 
virtual bool utUpdateCacheInfo ()
 

Additional Inherited Members

- Static Public Member Functions inherited from UT_Cache
static const UT_ValArray
< UT_Cache * > & 
utGetCacheList ()
 get the list of caches More...
 
static void setCacheAddRemoveCB (void(*callback)(void *), void *data)
 callback to be called when a cache is added or deleted. More...
 
static int64 utClearSpaceFromCaches (int64 amount)
 this method attempts to free up 'amount' bytes from all the caches. More...
 

Detailed Description

Variant of UT_CappedCache that improves on item construction. This adds in a mechanism for locking items during construction, to prevent multiple threads from performing the same work to initialize cache items.

Definition at line 82 of file UT_CappedCache.h.

Constructor & Destructor Documentation

GusdUT_CappedCache::GusdUT_CappedCache ( const char *  name,
int64  size_in_mb = 32 
)
inline

Definition at line 85 of file UT_CappedCache.h.

GusdUT_CappedCache::~GusdUT_CappedCache ( )
inlineoverride

Definition at line 87 of file UT_CappedCache.h.

Member Function Documentation

template<typename MatchFn >
int64 GusdUT_CappedCache::ClearEntries ( const MatchFn &  matchFn)

Definition at line 170 of file UT_CappedCache.h.

template<typename Item >
UT_IntrusivePtr< const Item > GusdUT_CappedCache::Find ( const UT_CappedKey key)

Definition at line 129 of file UT_CappedCache.h.

template<typename Item , typename Creator , typename... Args>
UT_IntrusivePtr< const Item > GusdUT_CappedCache::FindOrCreate ( const UT_CappedKey key,
const Creator &  creator,
Args &...  args 
)

Definition at line 140 of file UT_CappedCache.h.

template<typename T , typename Creator , typename... Args>
bool GusdUT_CappedCache::FindOrCreateVal ( const UT_CappedKey key,
const Creator &  creator,
Args &...  args 
)
template<typename T >
bool GusdUT_CappedCache::FindVal ( const UT_CappedKey key)

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