|
The Vish Visualization Shell 0.3
Vish
|
Main administrative Cache object container. More...
#include <elementary/memcore/Cache.hpp>
Classes | |
| struct | OutOfMemory |
| Exception that is thrown when out of memory. More... | |
Public Member Functions | |
| Cache (memsize_t MCost, const std::string &s) | |
| Constructor: specify the maximally allowed cost. | |
| virtual bool | handleOutOfMemory (const RefPtr< Cacheable > &Ca, const WeakPtr< Creature > &theCreature) |
| A virtual function that is called during Creature::enableCaching() for as long as it returns true. | |
| bool | insert (const WeakPtr< Cacheable, Cacheable > &Ca, bool CreateAsOld) |
| Insert some object with a given cost. | |
| auto | iterate (Iterator &It) const -> decltype(Q.iterate(It)) |
| Iterate over cache entries. | |
| void | list_info (const type_info &CreatorDomain) |
| Print debug info for a certain type of creator objects. | |
| void | list_info (const type_info &CreatorDomain, const type_info &CacheableDomain) |
| Print debug info for a certain type of creator objects handling a domain of cacheable objects. | |
| memsize_t | maxCost () const override |
| get the maximally allowed cost | |
| double | maxCostMiB () const |
| get the maximally allowed cost in MiB | |
| memsize_t | purge () |
| Remove all objects from the Cache. | |
| memsize_t | purge_Hades () |
| Clean up dead objects. | |
| bool | setMaxCost (memsize_t C) |
| Set the maximally allowed cost, return false if the specified cost could not be achieved because some objects could not be removed. | |
| memsize_t | totalCost (bool FreeableOnly=false) const override |
| Tell the total cost of all object that are currently stored in the cache. | |
| double | totalCostMiB (bool FreeableOnly=false) const |
| Get memory usage in MiB. | |
| bool | touch (const WeakPtr< Cacheable > &Ca) |
| Find old cacheable and push into the activity queue. | |
| ~Cache () | |
| Destructor. | |
Public Member Functions inherited from MemCore::CacheBase | |
| CacheBase (const std::string &name) | |
| Default constructor. | |
| virtual | ~CacheBase ()=0 |
| Destructor. | |
Public Member Functions inherited from MemCore::ReferenceBase< CacheBase > | |
| auto | getObjectCountID () const noexcept |
| Get a unique ID for this object in the given domain. | |
| bool | isIdentical (const WeakPtr< CacheBase, CacheBase > &PossibleSelf) const noexcept |
| Check if this object is identical to the one used by the given pointer. | |
| void | mkAutoDestructive () |
| Marks this object as being automatically destructed, e.g. | |
| refcount_t | refcount () const noexcept |
| The strong reference count. | |
| ReferenceBase (CacheBase *that) noexcept | |
| Constructor, initializes reference counter to zero. | |
| const auto & | self () const |
| Return weak pointer to the object self. | |
| refcount_t | wrefcount () const noexcept |
| The weak reference count. | |
Static Public Member Functions | |
| static RefPtr< Cache, CacheBase > & | MemCache () |
| A global memory cache object, intended to be used for global RAM caching purposes. | |
| static int | verbosity () |
| Flag to tell if any information about the cacheing stuff, e.g. | |
Additional Inherited Members | |
Public Types inherited from MemCore::ReferenceBase< CacheBase > | |
| using | reference_domain_t = CacheBase |
| The type of the base class. | |
| using | SelfPtr_t = WeakPtr< CacheBase, CacheBase > |
| Type for a pointer to this object itself. | |
Public Attributes inherited from MemCore::CacheBase | |
| std::string | ElementDescription |
| Just some informative text. | |
Protected Member Functions inherited from MemCore::ReferenceBase< CacheBase > | |
| virtual void | extremeUnction () |
| A virtual function that will be called just before the object is destroyed. | |
| ReferenceBase & | operator= (const ReferenceBase &R) |
| Protected assignment operator (should not be called). | |
| void | suicide () |
| Delete this. | |
| virtual | ~ReferenceBase () |
| Virtual destructor. | |
Main administrative Cache object container.
|
virtual |
A virtual function that is called during Creature::enableCaching() for as long as it returns true.
By default it throws an exception. Should it return false, then out of memory situations will be silently ignored. This is not recommended!
References MemCore::ReferenceBase< CacheBase >::self().
Insert some object with a given cost.
insert some object with a given cost.
| Ca | The object carrying the data |
The cacheable object must exist and have a valid Creator attached, i.e. the one that was used to create it and allows to release it.
References MemCore::CacheBase::ElementDescription, MemCore::getAvailableMemory(), MemCore::getMemorySize(), MemCore::getMemUsage(), MemCore::CreatorCacheMap::insert(), maxCost(), MemCore::VerboseStream::MemString(), MemCore::CreatorCacheMap::nEntries(), purge_Hades(), totalCost(), and verbosity().
Find old cacheable and push into the activity queue.
find old and push to back
References MemCore::CreatorCacheMap::touch().
|
static |
Flag to tell if any information about the cacheing stuff, e.g.
loading and releasing objects, shall be printed to stdio for debugging purposes. It is set from the environment variable MEMCACHE_VERBOSITY.
References MemCore::getEnvInteger().
Referenced by MemCore::CacheMap::adjust(), insert(), and MemCore::CacheMap::list_info().