コード例 #1
0
//------------------------------hash method-----------------------------------
uint8_t CRedisClient::hset(const std::string &key, const std::string &field, const std::string &value)
{
   Command cmd( "HSET" );
   cmd << key << field << value;
   int64_t num = 0;
   _getInt( cmd , num );
   return num;
}
コード例 #2
0
uint64_t CRedisClient::lastsave()
{
    Command cmd( "LASTSAVE" );
    int64_t num;
    _getInt(cmd,num);
    return num;

}
コード例 #3
0
uint64_t CRedisClient::hlen(const string &key)
{
   Command cmd( "HLEN" );
   cmd << key;
   int64_t num = 0;
  _getInt( cmd, num );
  return num;
}
コード例 #4
0
uint64_t CRedisClient::dbsize()
{
    Command cmd( "DBSIZE" );
    int64_t num;
    _getInt(cmd,num);
    return num;

}
コード例 #5
0
bool CRedisClient::hsetnx(const string &key, const string &field, const string &value)
{
    Command cmd( "HSETNX" );
    cmd << key << field << value;
    int64_t num = 0;
    _getInt( cmd, num );
    return ( num==1 ? true:false );
}
コード例 #6
0
ファイル: RedisClientPSub.cpp プロジェクト: zxh1993/Taiji
 uint64_t CRedisClient::psubnumpat()
 {
	Command cmd( "PUBSUB" );
	cmd << "NUMPAT";
	int64_t num = 0;
	_getInt( cmd, num );
	return num;
 }
コード例 #7
0
ファイル: RedisClientPSub.cpp プロジェクト: zxh1993/Taiji
 uint64_t CRedisClient::publish( const string& channel, const string& message )
 {
	Command cmd( "PUBLISH" );
	cmd << channel << message;
	int64_t num = 0;
	_getInt( cmd, num );
	return num;
 }
コード例 #8
0
bool CRedisClient::hexists(const string &key, const string &field)
{
    Command cmd( "HEXISTS" );
    cmd << key << field;
    int64_t num = 0;
    _getInt( cmd, num );
    return ( num==1 ? true:false );
}
コード例 #9
0
bool CRedisClient::sismember(const string &key, const string &member)
{
    Command cmd( "SISMEMBER" );
    cmd << key << member;

    int64_t num = 0;
    _getInt( cmd, num );
    return ( num == 1 ? true: false );
}
コード例 #10
0
ファイル: RedisClientKey.cpp プロジェクト: hehe1112/MyProject
bool RedisClient::exists( const string& key )
{
	BuildCommand cmd("EXISTS");
	cmd << key;
	SInt64 num = 0;
	_getInt(cmd, num);
	return num;

}
コード例 #11
0
int64_t CRedisClient::hincrby(const string &key, const string &field, int64_t increment)
{
    Command cmd( "HINCRBY" );
    cmd << key << field << increment;

    int64_t num = 0;
    _getInt( cmd, num );
    return num;
}
コード例 #12
0
ファイル: RedisClientKey.cpp プロジェクト: hehe1112/MyProject
bool RedisClient::renameNx( const string& key , const string& newKey )
{
	BuildCommand cmd("RENAMENX");
	SInt64 num = 0;
	cmd << key << newKey;

	if ( _getInt(cmd, num) )
	{
		return num;
	}
	return false;
}
コード例 #13
0
ファイル: RedisClientKey.cpp プロジェクト: hehe1112/MyProject
string RedisClient::object( const EobjSubCommand& subcommand , const string& key )
{
	BuildCommand cmd("OBJECT");
	SInt64 num = 0;
	string retStr;
	std::stringstream ss;
	switch ( subcommand )
	{
	case REFCOUNT :
		cmd << "REFCOUNT" << key;
		if ( _getInt(cmd, num) )
		{
			ss << num;
			return ss.str();
		}
		break;

	case IDLETIME :
		cmd << "IDLETIME" << key;
		if ( _getInt(cmd, num) )
		{
			ss << num;
			return ss.str();
		}
		break;

	case ENCODING :
		cmd << "ENCODING" << key;

		if ( _getString(cmd, retStr) )
		{
			return retStr;
		}
		break;

	}

	return REDIS_NIL;
}
コード例 #14
0
uint64_t CRedisClient::sunionstroe(const string &dest, const CRedisClient::VecString &keys)
{
    Command cmd( "SUNIONSTORE" );
    cmd << dest;
    VecString::const_iterator it = keys.begin();
    VecString::const_iterator end = keys.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }
    int64_t num;
    _getInt( cmd, num );
    return num;
}
コード例 #15
0
uint64_t CRedisClient::sinterstore( const string& destKey ,const CRedisClient::VecString &keys )
{
    Command cmd( "SINTERSTORE" );
    cmd << destKey;
    VecString::const_iterator it = keys.begin();
    VecString::const_iterator end = keys.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    int64_t num = 0;
    _getInt( cmd, num );
    return num;
}
コード例 #16
0
uint64_t CRedisClient::sadd(const string &key, const CRedisClient::VecString &members)
{
    Command cmd( "SADD" );
    cmd << key;
    VecString::const_iterator it = members.begin();
    VecString::const_iterator end = members.end();

    for ( ; it != end ; ++it )
    {
        cmd << *it;
    }
    int64_t num;
    _getInt( cmd , num );
    return num;
}
コード例 #17
0
ファイル: RedisClientKey.cpp プロジェクト: hehe1112/MyProject
SInt64 RedisClient::del( RedisClient::VecString &keys )
{

	BuildCommand cmd("DEL");

	VecString::const_iterator it = keys.begin();
	VecString::const_iterator end = keys.end();
	for ( ; it != end ; ++it )
	{
		cmd << *it;
	}

	SInt64 num = 0;
	_getInt(cmd, num);
	return num;
}
コード例 #18
0
uint64_t CRedisClient::hdel( const string &key, const CRedisClient::VecString &fields )
{
    Command cmd( "HDEL" );
    cmd << key;

    VecString::const_iterator it = fields.begin();
    VecString::const_iterator end = fields.end();
    for ( ; it != end; ++it )
    {
        cmd << *it;
    }

    int64_t num = 0;
    _getInt( cmd , num );
    return num;
}