mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
Redis 缓存测试
This commit is contained in:
2
library/think/cache/driver/Redis.php
vendored
2
library/think/cache/driver/Redis.php
vendored
@@ -27,7 +27,7 @@ class Redis
|
||||
'port' => 6379,
|
||||
'password' => '',
|
||||
'timeout' => false,
|
||||
'expire' => 0,
|
||||
'expire' => false,
|
||||
'persistent' => false,
|
||||
'length' => 0,
|
||||
];
|
||||
|
||||
53
tests/thinkphp/library/think/cache/driver/redisTest.php
vendored
Normal file
53
tests/thinkphp/library/think/cache/driver/redisTest.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Redis缓存驱动测试
|
||||
* @author 7IN0SAN9 <me@7in0.me>
|
||||
*/
|
||||
|
||||
namespace tests\thinkphp\library\think\cache\driver;
|
||||
|
||||
class redisTest extends cacheTestCase
|
||||
{
|
||||
private $_cacheInstance = null;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
\think\Cache::connect(array('type' => 'redis', 'expire' => 2));
|
||||
}
|
||||
|
||||
protected function getCacheInstance()
|
||||
{
|
||||
if (!extension_loaded("redis")) {
|
||||
$this->markTestSkipped("Redis没有安装,已跳过测试!");
|
||||
}
|
||||
if (null === $this->_cacheInstance) {
|
||||
$this->_cacheInstance = new \think\cache\driver\Redis();
|
||||
}
|
||||
return $this->_cacheInstance;
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$cache = $this->prepare();
|
||||
$this->assertEquals('string_test', $cache->get('string_test'));
|
||||
$this->assertEquals(11, $cache->get('number_test'));
|
||||
}
|
||||
|
||||
public function testStoreSpecialValues()
|
||||
{
|
||||
}
|
||||
|
||||
public function testExpire()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user