SHOGUN
v1.1.0
|
Template class Cache implements a simple cache.
When the cache is full -- elements that are least used are freed from the cache. Thus for the cache to be effective one should not visit loop over objects, i.e. visit elements in order 0...num_elements (with num_elements >> the maximal number of entries in cache)
Classes | |
struct | TEntry |
Public Member Functions | |
CCache () | |
CCache (int64_t cache_size, int64_t obj_size, int64_t num_entries) | |
virtual | ~CCache () |
bool | is_cached (int64_t number) |
T * | lock_entry (int64_t number) |
void | unlock_entry (int64_t number) |
T * | set_entry (int64_t number) |
virtual const char * | get_name () const |
Protected Attributes | |
bool | cache_is_full |
int64_t | entry_size |
int64_t | nr_cache_lines |
TEntry * | lookup_table |
TEntry ** | cache_table |
T * | cache_block |
CCache | ( | int64_t | cache_size, |
int64_t | obj_size, | ||
int64_t | num_entries | ||
) |
virtual const char* get_name | ( | ) | const [virtual] |
bool is_cached | ( | int64_t | number | ) |
T* lock_entry | ( | int64_t | number | ) |
T* set_entry | ( | int64_t | number | ) |
void unlock_entry | ( | int64_t | number | ) |
T* cache_block [protected] |
bool cache_is_full [protected] |
TEntry** cache_table [protected] |
int64_t entry_size [protected] |
TEntry* lookup_table [protected] |
int64_t nr_cache_lines [protected] |