forked from treefrogframework/treefrog-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtcacheredisstore.cpp
More file actions
67 lines (48 loc) · 1.12 KB
/
Copy pathtcacheredisstore.cpp
File metadata and controls
67 lines (48 loc) · 1.12 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
64
65
66
67
/* Copyright (c) 2019, AOYAMA Kazuharu
* All rights reserved.
*
* This software may be used and distributed according to the terms of
* the New BSD License, which is incorporated herein by reference.
*/
#include "tcacheredisstore.h"
#include <TRedis>
TCacheRedisStore::TCacheRedisStore()
{
}
bool TCacheRedisStore::open()
{
return true;
}
void TCacheRedisStore::close()
{
}
QByteArray TCacheRedisStore::get(const QByteArray &key)
{
TRedis redis(Tf::KvsEngine::CacheKvs);
return redis.get(key);
}
bool TCacheRedisStore::set(const QByteArray &key, const QByteArray &value, int seconds)
{
TRedis redis(Tf::KvsEngine::CacheKvs);
return redis.setEx(key, value, seconds);
}
bool TCacheRedisStore::remove(const QByteArray &key)
{
TRedis redis(Tf::KvsEngine::CacheKvs);
return redis.del(key);
}
void TCacheRedisStore::clear()
{
TRedis redis(Tf::KvsEngine::CacheKvs);
return redis.flushDb();
}
void TCacheRedisStore::gc()
{
}
QMap<QString, QVariant> TCacheRedisStore::defaultSettings() const
{
QMap<QString, QVariant> settings {
{"HostName", "localhost"},
};
return settings;
}