mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 22:52:49 +08:00
@@ -41,10 +41,23 @@ class redisTest extends cacheTestCase
|
||||
$cache = $this->prepare();
|
||||
$this->assertEquals('string_test', $cache->get('string_test'));
|
||||
$this->assertEquals(11, $cache->get('number_test'));
|
||||
$result = $cache->get('array_test');
|
||||
$this->assertEquals('array_test', $result['array_test']);
|
||||
}
|
||||
|
||||
public function testStoreSpecialValues()
|
||||
{
|
||||
$redis = new \think\cache\driver\Redis(['length' => 3]);
|
||||
$redis->set('key', 'value');
|
||||
$redis->get('key');
|
||||
|
||||
$redis->handler()->setnx('key', 'value');
|
||||
$value = $redis->handler()->get('key');
|
||||
$this->assertEquals('value', $value);
|
||||
|
||||
$redis->handler()->hset('hash', 'key', 'value');
|
||||
$value = $redis->handler()->hget('hash', 'key');
|
||||
$this->assertEquals('value', $value);
|
||||
}
|
||||
|
||||
public function testExpire()
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace tests\thinkphp\library\think\cache\driver;
|
||||
|
||||
/**
|
||||
* Redisd缓存驱动测试
|
||||
* @author 尘缘 <130775@qq.com>
|
||||
*/
|
||||
|
||||
namespace tests\thinkphp\library\think\cache\driver;
|
||||
|
||||
class redisdTest extends cacheTestCase
|
||||
{
|
||||
private $_cacheInstance = null;
|
||||
@@ -31,7 +30,7 @@ class redisdTest extends cacheTestCase
|
||||
protected function getCacheInstance()
|
||||
{
|
||||
if (null === $this->_cacheInstance) {
|
||||
$this->_cacheInstance = new \think\cache\driver\Redisd(['length' => 3]);
|
||||
$this->_cacheInstance = new \think\cache\driver\Redisd();
|
||||
}
|
||||
return $this->_cacheInstance;
|
||||
}
|
||||
@@ -47,6 +46,20 @@ class redisdTest extends cacheTestCase
|
||||
|
||||
public function testStoreSpecialValues()
|
||||
{
|
||||
$redis = new \think\cache\driver\Redisd(['length' => 3]);
|
||||
$redis->master(true);
|
||||
|
||||
$redis->handler()->setnx('key', 'value');
|
||||
$value = $redis->handler()->get('key');
|
||||
$this->assertEquals('value', $value);
|
||||
|
||||
$redis->handler()->hset('hash', 'key', 'value');
|
||||
$value = $redis->handler()->hget('hash', 'key');
|
||||
$this->assertEquals('value', $value);
|
||||
|
||||
$redis->master(true)->hset('hash', 'key', 'value');
|
||||
$value = $redis->master(false)->hget('hash', 'key');
|
||||
$this->assertEquals('value', $value);
|
||||
}
|
||||
|
||||
public function testExpire()
|
||||
|
||||
Reference in New Issue
Block a user