StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHyperCacheI.h
1 #ifndef __ST_HYPERCACHEI_H
2 #define __ST_HYPERCACHEI_H
3 
4 #include <ctime>
5 #include <string>
6 #include <vector>
7 
9 {
10 public:
11  StHyperCacheI();
12  virtual ~StHyperCacheI();
13 
14  // initialization procedures like memcache server connect or file cache initialization
15  virtual bool init() = 0;
16 
17  // get cached object(s) by primary key. returns pointer to data, which length is passed by reference
18  virtual const char* get(const std::string& group_key, const std::string& key, size_t& value_length) = 0;
19  // put object to cache
20  virtual bool set(const std::string& group_key, const std::string& key, const char* data, size_t dataLength, time_t expirationTime = 0) = 0;
21  // replace existing object in cache with one provided
22  virtual bool replace(const std::string& group_key, const std::string& key, const char* data, size_t dataLength, time_t expirationTime = 0) = 0;
23  // remove existing object from cache, if exists
24  virtual bool remove(const std::string& group_key, const std::string& key) = 0;
25  // remove all entries from cache
26  virtual void clear() = 0;
27 
28  // return some statistics parameters for this cache
29  virtual std::string getStat() = 0;
30  // return cache name (underlying engine)
31  virtual const std::string& getName() = 0;
32  // return cache implementation version
33  virtual const std::string& getVersion() = 0;
34  // return cache type
35  virtual const std::string& getType() = 0;
36 
37 };
38 
39 #endif // __ST_HYPERCACHEI_H
40