| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #pragma once
- #if defined(_MSC_VER) || defined(WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32)
- #ifdef _OCC_P_REDISCLIENT_SDK
- #define _OCC_P_REDISCLIENT_API __declspec(dllexport)
- #else
- #define _OCC_P_REDISCLIENT_API __declspec(dllimport)
- #endif
- #else //Linux
- #ifdef _OCC_P_REDISCLIENT_SDK
- #define _OCC_P_REDISCLIENT_API __attribute__ ((visibility("default")))
- #else
- #define _OCC_P_REDISCLIENT_API __attribute__ ((visibility("default")))
- #endif
- #endif //WIN32|WIN64
- #include <vector>
- #include <string>
- #include "RedisDefine.h"
- class xhRedisClient;
- class _OCC_P_REDISCLIENT_API YD_RedisClient
- {
- public:
- YD_RedisClient();
- ~YD_RedisClient();
- public:
- int StartRedis(const std::string& Str_IP, int nPort); //连接Redis数据库
- int Stop(); //断开Redis数据库
- int Set(const std::string& strKey, const std::string& strValue); //设置-Key和Value
- int Set(const std::vector<std::pair<std::string, std::string>> & vcmd); //设置-vcmd
- int Set(const ST_REDISBUFFER & RedisBuffer); //设置-RedisBuffer
- int Set(const std::vector<ST_REDISBUFFER> & vcmd); //设置-vcmd
- int lSet(const std::string& strKey, const std::string& strValue,int nIndex);//设置-Key和Value和nIndex
- int lPush(const std::string& strKey, const std::string& strValue); //按照List存入数据库
- int lRange(const std::string& strKey, std::string& strValue); //按照List存入数据库
- int Get(const std::string& strKey, std::string& strValue); //读取-数据库中Key和Value
- int Get(std::vector<std::pair<std::string, std::string>> & vcmd); //读取-vcmd
- int Get(ST_REDISBUFFEROUT& RedisBuffer); //读取-RedisBuffer
- int Get(std::vector<ST_REDISBUFFEROUT>& vcmd); //读取-vcmd
- int DoCmd(const std::string& strCmd, std::string& strReply); //执行指令
- private:
- xhRedisClient* m_pClient;
- };
|