mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
增加缓存驱动的queue测试
This commit is contained in:
@@ -50,14 +50,4 @@ class apcTest extends cacheTestCase
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testQueue()
|
|
||||||
{
|
|
||||||
$cache = $this->getCacheInstance();
|
|
||||||
$this->assertTrue($cache->set('1', '1'));
|
|
||||||
$this->assertTrue($cache->set('2', '2'));
|
|
||||||
$this->assertTrue($cache->set('3', '3'));
|
|
||||||
$this->assertEquals(1, $cache->get('1'));
|
|
||||||
$this->assertTrue($cache->set('4', '4'));
|
|
||||||
$this->assertFalse($cache->get('1'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,4 +159,15 @@ abstract class cacheTestCase extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('a', Cache::get('a'));
|
$this->assertEquals('a', Cache::get('a'));
|
||||||
$this->assertNotNull(Cache::rm('a'));
|
$this->assertNotNull(Cache::rm('a'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testQueue()
|
||||||
|
{
|
||||||
|
$cache = $this->prepare();
|
||||||
|
$this->assertTrue($cache->set('1', '1'));
|
||||||
|
$this->assertTrue($cache->set('2', '2'));
|
||||||
|
$this->assertTrue($cache->set('3', '3'));
|
||||||
|
$this->assertEquals(1, $cache->get('1'));
|
||||||
|
$this->assertTrue($cache->set('4', '4'));
|
||||||
|
$this->assertFalse($cache->get('1'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class memcachedTest extends cacheTestCase
|
|||||||
protected function getCacheInstance()
|
protected function getCacheInstance()
|
||||||
{
|
{
|
||||||
if (null === $this->_cacheInstance) {
|
if (null === $this->_cacheInstance) {
|
||||||
$this->_cacheInstance = new \think\cache\driver\Memcached();
|
$this->_cacheInstance = new \think\cache\driver\Memcached(['length' => 3]);
|
||||||
}
|
}
|
||||||
return $this->_cacheInstance;
|
return $this->_cacheInstance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class redisTest extends cacheTestCase
|
|||||||
protected function getCacheInstance()
|
protected function getCacheInstance()
|
||||||
{
|
{
|
||||||
if (null === $this->_cacheInstance) {
|
if (null === $this->_cacheInstance) {
|
||||||
$this->_cacheInstance = new \think\cache\driver\Redis();
|
$this->_cacheInstance = new \think\cache\driver\Redis(['length' => 3]);
|
||||||
}
|
}
|
||||||
return $this->_cacheInstance;
|
return $this->_cacheInstance;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user