Example #1
0
void test_strings_setnx(Ardb& db)
{
    DBID dbid = 0;
    db.Set(dbid, "intkey1", "123");
    CHECK_FATAL(db.SetNX(dbid, "intkey1", "2345") == 0, "SetNX intkey failed");
    db.Del(dbid, "intkey1");
    CHECK_FATAL(db.SetNX(dbid, "intkey1", "2345") != 0, "SetNX intkey failed");
}
Example #2
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");
}