예제 #1
0
static bool test_zcard(acl::redis_zset& redis, int i, const char* key)
{
	// 因为该协议数据比较小,所以在组装请求数据时不必采用分片方式
	redis.get_client()->set_slice_request(false);

	int ret = redis.zcard(key);
	if (ret < 0)
	{
		printf("zcard key: %s error\r\n", key);
		return false;
	}
	else if (i < 10)
		printf("zcard ok, key: %s, count: %d\r\n", key, ret);

	return true;
}
예제 #2
0
파일: redis_zset.cpp 프로젝트: 39608106/acl
static bool test_zcard(acl::redis_zset& redis, int n)
{
	acl::string key;

	for (int i = 0; i < n; i++)
	{
		key.format("%s_%d", __keypre.c_str(), i);
		redis.clear();
		int ret = redis.zcard(key.c_str());
		if (ret < 0)
		{
			printf("zcard key: %s error\r\n", key.c_str());
			return false;
		}
		else if (i < 10)
			printf("zcard ok, key: %s, count: %d\r\n",
				key.c_str(), ret);
	}

	return true;
}