Пример #1
0
void test_strings_exists(Ardb& db)
{
    DBID dbid = 0;
    db.Del(dbid, "intkey1");
    CHECK_FATAL(db.Exists(dbid, "intkey1"), "Exists intkey1 failed");
    db.Set(dbid, "intkey1", "123");
    CHECK_FATAL(db.Exists(dbid, "intkey1") == false, "Exists intkey failed");
}
Пример #2
0
void test_set_expire(Ardb& db)
{
	DBID dbid = 0;
	db.SClear(dbid, "myset");
	db.SAdd(dbid, "myset", "123");
	db.Expire(dbid, "myset", 1);
	CHECK_FATAL(db.Exists(dbid, "myset") == false, "Expire myset failed");
	sleep(2);
	CHECK_FATAL(db.Exists(dbid, "myset") == true, "Expire myset failed");
}
Пример #3
0
void test_strings_expire(Ardb& db)
{
    DBID dbid = 0;
    ValueData v;
    db.Set(dbid, "intkey1", "123");
    db.Expire(dbid, "intkey1", 1);
    CHECK_FATAL(db.Exists(dbid, "intkey1") == false, "Expire intkey1 failed");
    sleep(2);
    CHECK_FATAL(db.Exists(dbid, "intkey1") == true, "Expire intkey failed");
}
Пример #4
0
void test_zset_expire(Ardb& db)
{
    DBID dbid = 0;
    db.ZClear(dbid, "myzset");
    db.ZAdd(dbid, "myzset", ValueData((int64) 1), "one");
    db.Expire(dbid, "myzset", 1);
    CHECK_FATAL(db.Exists(dbid, "myzset") == false, "Expire myzset failed");
    sleep(2);
    CHECK_FATAL(db.Exists(dbid, "myzset") == true, "Expire myzset failed");
}