bes  Updated for version 3.20.5
BESH4MCache.h
1 //
8 #ifndef _bes_h4m_cache_h
9 #define _bes_h4m_cache_h
10 
11 #include <unistd.h>
12 #include <string>
13 #include <vector>
14 #include "BESFileLockingCache.h"
15 
17 {
18 private:
19  static bool d_enabled;
20  static BESH4Cache *d_instance;
21  static void delete_instance() { delete d_instance; d_instance = 0; }
22 
23  BESH4Cache();
24 
25 public:
26  static const string PATH_KEY;
27  static const string PREFIX_KEY;
28  static const string SIZE_KEY;
29  virtual ~BESH4Cache() {}
30 
31  static long getCacheSizeFromConfig();
32  static string getCachePrefixFromConfig();
33  static string getCacheDirFromConfig();
34 
35  bool is_valid(const string & cache_file_name, const int expected_file_size);
36  static BESH4Cache *get_instance();
37  bool get_data_from_cache(const string &cache_file_name, const int expected_file_size,int &fd);
38  bool write_cached_data(const string &cache_file_name,const int expected_file_size,const std::vector<double> &val);
39  bool write_cached_data2(const string &cache_file_name,const int expected_file_size,const void *buf);
40 };
41 
42 #endif
43 
Implementation of a caching mechanism for compressed data.
static BESH4Cache * get_instance()
Definition: BESH4MCache.cc:100