Menu

[r663]: / framework / trunk / cache_interface.h  Maximize  Restore  History

Download this file

64 lines (53 with data), 1.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef CACHE_IFACE_H
#define CACHE_IFACE_H
#include <string>
#include <set>
#include "archive.h"
#include "base_cache.h"
namespace cppcms {
using namespace std;
class worker_thread;
class cache_iface {
worker_thread *cms;
set<string> triggers;
public:
void reset() { triggers.clear(); };
cache_iface(worker_thread *w) : cms (w) {};
bool fetch_page(string const &key);
void store_page(string const &key,int timeout=-1);
void rise(string const &trigger);
void add_trigger(string const &trigger);
bool fetch_frame(string const &key,string &result,bool notriggers=false);
void store_frame(string const &key,
string const &frame,
set<string> const &triggers=set<string>(),
int timeout=-1,
bool notriggers=false);
void store_frame(string const &key,
string const &frame,
int timeout,
bool notriggers=false)
{
store_frame(key,frame,set<string>(),timeout,notriggers);
}
bool fetch_data(string const &key,serializable &data,bool notriggers=false);
void store_data(string const &key,serializable const &data,
set<string> const &triggers=set<string>(),
int timeout=-1,bool notriggers=false);
void store_data(string const &key,serializable const &data,int timeout,bool notriggers=false)
{
store_data(key,data,set<string>(),timeout,notriggers);
}
void clear();
bool stats(unsigned &keys,unsigned &triggers);
};
void deflate(string const &text,ostream &stream,long level,long length);
string deflate(string const &text,long level,long length);
class cache_factory {
public:
virtual base_cache *get() const { return NULL; };
virtual void del(base_cache *p) const { };
virtual ~cache_factory() {};
};
}
#endif
MongoDB Logo MongoDB