bool CRedisClient::hsetnx(const string &key, const string &field, const string &value)
{
    CResult result;
    hsetnx( key, field, value,result );

    ReplyType type = result.getType();
    if ( REDIS_REPLY_ERROR == type )
    {
        throw ReplyErr( result.getErrorString() );
    }else if ( REDIS_REPLY_INTEGERER != type )
    {
        throw ProtocolErr( "HSETNX: data recved is not intergerer" );
    }
    return ( result.getInt()==1?true:false );
}
Exemple #2
0
int redis_hash::hsetnx(const char* key, const char* name,
	const char* value, size_t value_len)
{
	return hsetnx(key, name, strlen(name), value, value_len);
}
Exemple #3
0
int redis_hash::hsetnx(const char* key, const char* name, const char* value)
{
	return hsetnx(key, name, value, strlen(value));
}