mirror of
https://github.com/predis/predis.git
synced 2026-08-30 04:02:22 +00:00
New command: PERSIST (Redis v2.2-dev).
This commit is contained in:
@@ -1822,6 +1822,9 @@ class RedisServer_vNext extends RedisServer_v2_0 {
|
||||
/* commands operating on string values */
|
||||
'strlen' => '\Predis\Commands\Strlen',
|
||||
|
||||
/* commands operating on the key space */
|
||||
'persist' => '\Predis\Commands\Persist',
|
||||
|
||||
/* commands operating on lists */
|
||||
'rpushx' => '\Predis\Commands\ListPushTailX',
|
||||
'lpushx' => '\Predis\Commands\ListPushHeadX',
|
||||
@@ -2400,6 +2403,11 @@ class ExpireAt extends \Predis\MultiBulkCommand {
|
||||
public function parseResponse($data) { return (bool) $data; }
|
||||
}
|
||||
|
||||
class Persist extends \Predis\MultiBulkCommand {
|
||||
public function getCommandId() { return 'PERSIST'; }
|
||||
public function parseResponse($data) { return (bool) $data; }
|
||||
}
|
||||
|
||||
class DatabaseSize extends \Predis\MultiBulkCommand {
|
||||
public function canBeHashed() { return false; }
|
||||
public function getCommandId() { return 'DBSIZE'; }
|
||||
|
||||
@@ -337,6 +337,18 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals(-1, $this->redis->ttl('foo'));
|
||||
}
|
||||
|
||||
function testPersist() {
|
||||
$this->redis->set('foo', 'bar');
|
||||
|
||||
$this->assertTrue($this->redis->expire('foo', 1));
|
||||
$this->assertEquals(1, $this->redis->ttl('foo'));
|
||||
$this->assertTrue($this->redis->persist('foo'));
|
||||
$this->assertEquals(-1, $this->redis->ttl('foo'));
|
||||
|
||||
$this->assertFalse($this->redis->persist('foo'));
|
||||
$this->assertFalse($this->redis->persist('foobar'));
|
||||
}
|
||||
|
||||
function testSetExpire() {
|
||||
$this->assertTrue($this->redis->setex('foo', 10, 'bar'));
|
||||
$this->assertTrue($this->redis->exists('foo'));
|
||||
|
||||
Reference in New Issue
Block a user