Example #1
0
 protected static function _getConnection()
 {
     if (!self::$_connection) {
         self::$_connection = jKVDb::getConnection('jpref');
     }
     return self::$_connection;
 }
Example #2
0
 public function testFlush()
 {
     $kv = jKVDb::getConnection($this->profile);
     $kv->set('flush1DataKey', 'some data', 0);
     $kv->setWithTtl('flush2DataKey', 'data to remove', strtotime("+1 day"));
     $kv->setWithTtl('flush3DataKey', 'other data to remove', time() + 30);
     // should test that keys exists
     $this->assertTableContainsRecords('testkvdb', array(array('k_key' => 'flush1DataKey', 'k_value' => serialize('some data')), array('k_key' => 'flush2DataKey', 'k_value' => serialize('data to remove')), array('k_key' => 'flush3DataKey', 'k_value' => serialize('other data to remove'))));
     $this->assertTrue($kv->flush());
     // should test that keys doesn't exist anymore
     $this->assertTableIsEmpty('testkvdb');
 }
Example #3
0
 public function testFlush()
 {
     $kv = jKVDb::getConnection($this->profile);
     $kv->set('flush1DataKey', 'some data', 0);
     $kv->setWithTtl('flush2DataKey', 'data to remove', strtotime("+1 day"));
     $kv->setWithTtl('flush3DataKey', 'other data to remove', time() + 30);
     $this->assertTrue(file_exists(jApp::tempPath() . 'kvfiles/tests/b6/d7/b6d72473bc7663367d02de121871b573_flush1DataKey'));
     $this->assertTrue(file_exists(jApp::tempPath() . 'kvfiles/tests/e0/85/e085abf6184768075f5284e5700897c2_flush2DataKey'));
     $this->assertTrue(file_exists(jApp::tempPath() . 'kvfiles/tests/c8/52/c8527b170651bf375a29e9e77e867385_flush3DataKey'));
     $this->assertTrue($kv->flush());
     $this->assertFalse(file_exists(jApp::tempPath() . 'kvfiles/tests/b6/d7/b6d72473bc7663367d02de121871b573_flush1DataKey'));
     $this->assertFalse(file_exists(jApp::tempPath() . 'kvfiles/tests/e0/85/e085abf6184768075f5284e5700897c2_flush2DataKey'));
     $this->assertFalse(file_exists(jApp::tempPath() . 'kvfiles/tests/c8/52/c8527b170651bf375a29e9e77e867385_flush3DataKey'));
 }
 public function testFlush()
 {
     $kv = jKVDb::getConnection($this->profile);
     $kv->set('flush1DataKey', 'some data', 0);
     $kv->setWithTtl('flush2DataKey', 'data to remove', strtotime("+1 day"));
     $kv->setWithTtl('flush3DataKey', 'other data to remove', time() + 30);
     $this->assertTrue(memcache_get($this->mmc, 'flush1DataKey'));
     $this->assertTrue(memcache_get($this->mmc, 'flush2DataKey'));
     $this->assertTrue(memcache_get($this->mmc, 'flush3DataKey'));
     $this->assertTrue($kv->flush());
     $this->assertFalse(memcache_get($this->mmc, 'flush1DataKey'));
     $this->assertFalse(memcache_get($this->mmc, 'flush2DataKey'));
     $this->assertFalse(memcache_get($this->mmc, 'flush3DataKey'));
 }
Example #5
0
 public function testFlush()
 {
     $kv = jKVDb::getConnection($this->profile);
     $kv->set('flush1DataKey', 'some data', 0);
     $kv->setWithTtl('flush2DataKey', 'data to remove', strtotime("+1 day"));
     $kv->setWithTtl('flush3DataKey', 'other data to remove', time() + 30);
     $this->assertEqual($this->redis->get('flush1DataKey'), serialize('some data'));
     $this->assertEqual($this->redis->get('flush2DataKey'), serialize('data to remove'));
     $this->assertEqual($this->redis->get('flush3DataKey'), serialize('other data to remove'));
     $this->assertTrue($kv->flush());
     $this->assertNull($this->redis->get('flush1DataKey'));
     $this->assertNull($this->redis->get('flush2DataKey'));
     $this->assertNull($this->redis->get('flush3DataKey'));
 }
Example #6
0
 public function testDelete()
 {
     $kv = jKVDb::getConnection($this->profile);
     $kv->set('deleteKey', 'data to delete');
     $this->assertTrue($kv->delete('deleteKey'));
     $this->assertFalse($kv->get('deleteKey'));
     $this->assertFalse($kv->delete('inexistentKey'));
 }