45 static const unsigned int MAX_LOCK_RETRY_MS = 5000;
46 static const unsigned int MAX_LOCK_TRIES = 16;
103 std::ostringstream oss;
117 static const char BES_CACHE_CHAR =
'#';
121 unsigned long long _cache_size_in_megs ;
124 void check_ctor_params();
129 unsigned long long sizeInMegs ) ;
131 const string &cache_dir_key,
132 const string &prefix_key,
133 const string &size_key ) ;
136 virtual bool lock(
unsigned int retry_ms,
137 unsigned int num_tries ) ;
140 virtual bool is_cached(
const string &src,
string &target ) ;
141 virtual void purge( ) ;
145 string prefix( )
const {
return _prefix ; }
146 unsigned long long cache_size( )
const {
return _cache_size_in_megs ; }
152 virtual void dump( ostream &strm )
const ;
155 #endif // BESCache_h_
unsigned long long cache_size() const
virtual bool lock(unsigned int retry_ms, unsigned int num_tries)
lock the cache using a file lock
virtual void purge()
Check to see if the cache size exceeds the size specified in the constructor and purge older files un...
BESCache::CacheFilesByAgeMap _contents
virtual void dump(ostream &strm) const
dumps information about this object
unsigned long long _total_cache_files_size
std::multimap< double, cache_entry, std::greater< double > > CacheFilesByAgeMap
Sugar for the multimap of entries sorted with older files first.
Implementation of a caching mechanism.
for filename -> filesize map below
Helper class for info on the cache directory.
Base object for bes objects.
unsigned long long get_avg_size() const
void collect_cache_dir_info(BESCache::CacheDirInfo &cd_info) const
mapping of key/value pairs defining different behaviors of an application.
unsigned long long _num_files_in_cache
virtual bool unlock()
unlock the cache
std::string toString() const
string match_prefix() const
virtual bool is_cached(const string &src, string &target)
Determine if the file specified by src is cached.