forked from artyom-beilis/cppcms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcp_cache_client.h
55 lines (47 loc) · 1.47 KB
/
tcp_cache_client.h
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
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <[email protected]>
//
// See accompanying file COPYING.TXT file for licensing details.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef TCP_CHACHE_H
#define TCP_CHACHE_H
#include "base_cache.h"
#include <cppcms/cache_interface.h>
#include <cppcms/session_storage.h>
#include "tcp_connector.h"
#include <string>
namespace cppcms {
namespace impl {
class messenger;
struct tcp_operation_header;
class tcp_cache : public tcp_connector {
public:
tcp_cache( std::vector<std::string> const &ip_list,
std::vector<int> const &port_list)
:
tcp_connector(ip_list,port_list)
{
}
static const int up_to_date = -1;
static const int not_found = 0;
static const int found = 1;
int fetch( std::string const &key,
std::string &data,
std::set<std::string> *triggers,
time_t &timeout,
uint64_t &generation,
bool transfer_if_not_updated=false);
void rise(std::string const &trigger);
void clear();
void stats(unsigned &keys,unsigned &triggers);
void store( std::string const &key,
std::string const &data,
std::set<std::string> const &triggers,
time_t timeout);
~tcp_cache();
};
} // impl
} // cppcms
#endif