#include <file_cache_manager.h>
Public Types | |
typedef Key | key_type |
typedef Data | data_type |
typedef std::map< Key, std::pair< bool, data_type * > > | storage_type |
typedef unsigned long long | size_type |
typedef std::map< key_type, std::pair< unsigned long long, unsigned long long >, std::less< key_type > > | FileMap |
typedef FileMap::iterator | File_Map_iter |
typedef storage_type::iterator | storage_iterator |
typedef storage_type::const_iterator | storage_const_iterator |
typedef storage_type::value_type | storage_entry_type |
Public Member Functions | |
storage_iterator | begin () |
storage_iterator | end () |
storage_const_iterator | begin () const |
storage_const_iterator | end () const |
cache_manager (size_type C=0, const char *filename) | |
void | clear () |
size_type | size () const |
size_type | capacity () const |
size_type | mem_entries () const |
void | print_stats () const |
size_type | file_entries () const |
storage_const_iterator | find (const key_type &k) const |
void | lock_vat (const key_type &k) |
void | unlock_vat (const key_type &k) |
void | delete_vat (const key_type &k) |
bool | find_vat (const key_type &k) |
data_type * | get_vat_point (const key_type &k) |
bool | insert (const key_type &k, data_type *e) |
bool | update (size_type req_size=0, int levelone=1) |
cache_manager< Key, Data >::cache_manager | ( | size_type | C = 0 , |
|
const char * | filename | |||
) | [inline, explicit] |
Constructs cache_manager with capacity C and sets policies and statistics object.
C | is cache capacity. | |
filename | is the file name that will keep objects in case of their eviction |
storage_const_iterator cache_manager< Key, Data >::begin | ( | ) | const [inline] |
Returns const iterator to the beginning of the entries storage.
storage_iterator cache_manager< Key, Data >::begin | ( | ) | [inline] |
Returns iterator to the beginning of the entries storage.
size_type cache_manager< Key, Data >::capacity | ( | ) | const [inline] |
Returns capacity of the cache.
void cache_manager< Key, Data >::clear | ( | ) | [inline] |
Clears the memory map and the file map
void cache_manager< Key, Data >::delete_vat | ( | const key_type & | k | ) | [inline] |
Finds if there is an entry associated with a given key. If such exists , delete it from both the memory map and the file map.
storage_const_iterator cache_manager< Key, Data >::end | ( | ) | const [inline] |
Returns const iterator to the end of the internal storage.
storage_iterator cache_manager< Key, Data >::end | ( | ) | [inline] |
Returns iterator to the end of the internal storage.
size_type cache_manager< Key, Data >::file_entries | ( | ) | const [inline] |
Returns number of the entries in the file
storage_const_iterator cache_manager< Key, Data >::find | ( | const key_type & | k | ) | const [inline] |
Finds entry associated with a given key.
bool cache_manager< Key, Data >::find_vat | ( | const key_type & | k | ) | [inline] |
Finds if there is an entry associated with a given key. If such exists it returns true. Please note, we are looking in the memory map and in the file map.
data_type* cache_manager< Key, Data >::get_vat_point | ( | const key_type & | k | ) | [inline] |
Return a pointer to the vat that corresponds to the pattern
bool cache_manager< Key, Data >::insert | ( | const key_type & | k, | |
data_type * | e | |||
) | [inline] |
Inserts a new entry to the cache. Entry is associated with a given key. k is a key associated with inserted entry. e is an entry inserted to the cache. return true on success and false otherwise.
size_type cache_manager< Key, Data >::mem_entries | ( | ) | const [inline] |
Returns number of the entries in the cache.
void cache_manager< Key, Data >::print_stats | ( | ) | const [inline] |
Prints some statistics about the map
size_type cache_manager< Key, Data >::size | ( | ) | const [inline] |
Returns current size of the cache.