85 static DAPCache3 *d_instance;
87 static const char DAP_CACHE_CHAR =
'#';
93 unsigned long long d_max_cache_size_in_bytes;
95 unsigned long long d_target_size;
98 BESCache3(BESKeys *keys,
const string &cache_dir_key,
const string &prefix_key,
const string &size_key);
101 DAPCache3(
const string &cache_dir,
const string &prefix,
unsigned long long size);
105 DAPCache3(
const DAPCache3 &);
106 DAPCache3 &operator=(
const DAPCache3 &rhs);
108 void m_check_ctor_params();
109 void m_initialize_cache_info();
111 unsigned long long m_collect_cache_dir_info(
CacheFiles &contents);
117 void m_record_descriptor(
const string &file,
int fd);
118 int m_get_descriptor(
const string &file);
121 typedef std::map<string, int> FilesAndLockDescriptors;
122 FilesAndLockDescriptors d_locks;
125 virtual ~DAPCache3() {}
126 static void delete_instance();
129 static DAPCache3 *
get_instance(
const string &cache_dir,
const string &prefix,
unsigned long long size);
145 virtual bool cache_too_big(
unsigned long long current_size)
const;
151 static BESCache3 *
get_instance(BESKeys *keys,
const string &cache_dir_key,
const string &prefix_key,
const string &size_key);
virtual unsigned long long get_cache_size()
Get the cache size. Read the size information from the cache info file and return it....
string get_cache_file_name(const string &src, bool mangle=true)
virtual bool cache_too_big(unsigned long long current_size) const
look at the cache size; is it too large? Look at the cache size and see if it is too big.
virtual void purge_file(const string &file)
Purge a single file from the cache.
virtual bool get_read_lock(const string &target, int &fd)
Get a read-only lock on the file if it exists.
virtual void unlock_cache()
virtual void dump(ostream &strm) const
dumps information about this object
virtual void exclusive_to_shared_lock(int fd)
Transfer from an exclusive lock to a shared lock. If the file has an exclusive write lock on it,...
virtual void lock_cache_read()
virtual void unlock_and_close(const string &target)
virtual unsigned long long update_cache_info(const string &target)
Update the cache info file to include 'target'.
static DAPCache3 * get_instance()
virtual void update_and_purge(const string &new_file)
Purge files from the cache.
virtual void lock_cache_write()
virtual bool create_and_lock(const string &target, int &fd)
Create a file in the cache and lock it for write access. If the file does not exist,...
libdap base object for common functionality of libdap objects
top level DAP object to house generic methods
std::list< cache_entry > CacheFiles