acl/lib_acl_cpp/include/acl_cpp/session/redis_session.hpp

57 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
#include <map>
2017-06-02 14:47:24 +08:00
#include "../stdlib/string.hpp"
#include "session.hpp"
namespace acl
{
class redis;
class redis_client_cluster;
class ACL_CPP_API redis_session : public session
{
public:
redis_session(redis_client_cluster& cluster, size_t max_conns,
time_t ttl = 0, const char* sid = NULL);
~redis_session();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>ֵ
bool set(const char* name, const char* value);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>ֵ
bool set(const char* name, const void* value, size_t len);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <20><><EFBFBD><EFBFBD><EFBFBD>˵Ĺ<CBB5>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB>ö<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>Ե<EFBFBD>ֵ
const session_string* get_buf(const char* name);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <20><><EFBFBD><EFBFBD><EFBFBD>˵Ĺ<CBB5>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
bool del(const char* name);
// <20><><EFBFBD>ി<EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <20><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool remove();
// <20><><EFBFBD>ി<EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <20>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool get_attrs(std::map<string, session_string>& attrs);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <20>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool get_attrs(const std::vector<string>& names,
std::vector<session_string>& values);
// <20><><EFBFBD>ി<EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <20><><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
bool set_attrs(const std::map<string, session_string>& attrs);
protected:
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> session <20><> redis <20>ϵĻ<CFB5><C4BB><EFBFBD>ʱ<EFBFBD><CAB1>
bool set_timeout(time_t ttl);
private:
redis_client_cluster& cluster_;
redis* command_;
2017-07-20 10:59:28 +08:00
// size_t max_conns_;
std::map<string, session_string*> buffers_;
};
} // namespace acl