Esempio n. 1
0
static bool test_expire(acl::redis_key& option, int i)
{
	acl::string key;

	key.format("%s_%d", __keypre.c_str(), i);
	option.reset();
	if (option.expire(key.c_str(), 100) < 0)
	{
		printf("expire key: %s error\r\n", key.c_str());
		return false;
	}
	else if (i < 10)
		printf("expire ok, key: %s\r\n", key.c_str());
	return true;
}
Esempio n. 2
0
static bool test_type(acl::redis_key& option, int i)
{
	acl::string key;

	key.format("%s_%d", __keypre.c_str(), i);
	option.reset();
	acl::redis_key_t ret = option.type(key.c_str());
	if (ret == acl::REDIS_KEY_UNKNOWN)
	{
		printf("unknown type key: %s\r\n", key.c_str());
		return false;
	}
	else if (i < 10)
		printf("type ok, key: %s, ret: %d\r\n", key.c_str(), ret);
	return true;
}
Esempio n. 3
0
static bool test_del(acl::redis_key& option, int i)
{
	acl::string key;

	key.format("%s_%d", __keypre.c_str(), i);
	option.reset();
	int ret = option.del(key.c_str(), NULL);
	if (ret < 0)
	{
		printf("del key: %s error\r\n", key.c_str());
		return false;
	}
	else if (i < 10)
		printf("del ok, key: %s\r\n", key.c_str());
	return true;
}
Esempio n. 4
0
static bool test_ttl(acl::redis_key& option, int i)
{
	acl::string key;
	int ttl;

	key.format("%s_%d", __keypre.c_str(), i);
	option.reset();
	if ((ttl = option.ttl(key.c_str())) < 0)
	{
		printf("get ttl key: %s error\r\n", key.c_str());
		return false;
	}
	else if (i < 10)
		printf("ttl ok, key: %s, ttl: %d\r\n", key.c_str(), ttl);
	return true;
}
Esempio n. 5
0
static bool test_exists(acl::redis_key& option, int i)
{
	acl::string key;

	key.format("%s_%d", __keypre.c_str(), i);
	option.reset();
	if (option.exists(key.c_str()) == false)
	{
		if (i < 10)
			printf("no exists key: %s\r\n", key.c_str());
	}
	else
	{
		if (i < 10)
			printf("exists key: %s\r\n", key.c_str());
	}
	return true;
}