#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 #include #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> & vcmd); //设置-vcmd int Set(const ST_REDISBUFFER & RedisBuffer); //设置-RedisBuffer int Set(const std::vector & 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> & vcmd); //读取-vcmd int Get(ST_REDISBUFFEROUT& RedisBuffer); //读取-RedisBuffer int Get(std::vector& vcmd); //读取-vcmd int DoCmd(const std::string& strCmd, std::string& strReply); //执行指令 private: xhRedisClient* m_pClient; };