Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2022-10-08 19:24:57 +0300
committerMichael Grunder <michael.grunder@gmail.com>2022-10-08 20:51:50 +0300
commit9a3fe401dc559e2e8fdc769c189801edaa1d3c5b (patch)
tree30e199bd91e5c4d9bbbba2a16d7a338326759bf8 /tests
parent6ea978eb72507c3c21805de8bc916b1aa7f0f0dd (diff)
Implement new RESTORE options
Add the new RESTORE options REPLACE, ABSTTL, FREQ <freq> and IDLETIME <idletime> Fixes #1410
Diffstat (limited to 'tests')
-rw-r--r--tests/RedisTest.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/RedisTest.php b/tests/RedisTest.php
index 721ce525..57faf1af 100644
--- a/tests/RedisTest.php
+++ b/tests/RedisTest.php
@@ -5096,6 +5096,22 @@ class Redis_Test extends TestSuite
$this->assertTrue($this->redis->get('foo') === 'this-is-bar');
$this->assertTrue($this->redis->get('bar') === 'this-is-foo');
+ /* Test that we can REPLACE a key */
+ $this->assertTrue($this->redis->set('foo', 'some-value'));
+ $this->assertTrue($this->redis->restore('foo', 0, $d_bar, ['REPLACE']));
+
+ /* Ensure we can set an absolute TTL */
+ $this->assertTrue($this->redis->restore('foo', time() + 10, $d_bar, ['REPLACE', 'ABSTTL']));
+ $this->assertTrue($this->redis->ttl('foo') <= 10);
+
+ /* Ensure we can set an IDLETIME */
+ $this->assertTrue($this->redis->restore('foo', 0, $d_bar, ['REPLACE', 'IDLETIME' => 200]));
+ $this->assertTrue($this->redis->object('idletime', 'foo') > 100);
+
+ /* We can't neccissarily check this depending on LRU policy, but at least attempt to use
+ the FREQ option */
+ $this->assertTrue($this->redis->restore('foo', 0, $d_bar, ['REPLACE', 'FREQ' => 200]));
+
$this->redis->del('foo');
$this->redis->del('bar');
}