cache_manager< Key, Data > Class Template Reference

Class manages the memory cache for the file-based storage manager. cache_manager is responsible for bringing objects into memory and implementing eviction algorithm when the cache is full and a new object needs to be brought in. More...

#include <file_cache_manager.h>

List of all members.

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)


Detailed Description

template<typename Key, typename Data>
class cache_manager< Key, Data >

Class manages the memory cache for the file-based storage manager. cache_manager is responsible for bringing objects into memory and implementing eviction algorithm when the cache is full and a new object needs to be brought in.


Constructor & Destructor Documentation

template<typename Key, typename Data>
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.

Parameters:
C is cache capacity.
filename is the file name that will keep objects in case of their eviction


Member Function Documentation

template<typename Key, typename Data>
storage_const_iterator cache_manager< Key, Data >::begin (  )  const [inline]

Returns const iterator to the beginning of the entries storage.

template<typename Key, typename Data>
storage_iterator cache_manager< Key, Data >::begin (  )  [inline]

Returns iterator to the beginning of the entries storage.

template<typename Key, typename Data>
size_type cache_manager< Key, Data >::capacity (  )  const [inline]

Returns capacity of the cache.

template<typename Key, typename Data>
void cache_manager< Key, Data >::clear (  )  [inline]

Clears the memory map and the file map

template<typename Key, typename Data>
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.

template<typename Key, typename Data>
storage_const_iterator cache_manager< Key, Data >::end (  )  const [inline]

Returns const iterator to the end of the internal storage.

template<typename Key, typename Data>
storage_iterator cache_manager< Key, Data >::end (  )  [inline]

Returns iterator to the end of the internal storage.

template<typename Key, typename Data>
size_type cache_manager< Key, Data >::file_entries (  )  const [inline]

Returns number of the entries in the file

template<typename Key, typename Data>
storage_const_iterator cache_manager< Key, Data >::find ( const key_type &  k  )  const [inline]

Finds entry associated with a given key.

template<typename Key, typename Data>
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.

template<typename Key, typename Data>
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

template<typename Key, typename Data>
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.

template<typename Key, typename Data>
size_type cache_manager< Key, Data >::mem_entries (  )  const [inline]

Returns number of the entries in the cache.

template<typename Key, typename Data>
void cache_manager< Key, Data >::print_stats (  )  const [inline]

Prints some statistics about the map

template<typename Key, typename Data>
size_type cache_manager< Key, Data >::size (  )  const [inline]

Returns current size of the cache.


The documentation for this class was generated from the following file:
Generated on Wed Jul 26 14:01:08 2006 for DMTL by  doxygen 1.4.7