thinkphp/tests/thinkphp/library/think/cache/driver/liteTest.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?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>
// +----------------------------------------------------------------------

/**
 * Lite缓存驱动测试
 * @author    刘志淳 <chun@engineer.com>
 */

namespace tests\thinkphp\library\think\cache\driver;

use think\Cache;

class liteTest extends \PHPUnit_Framework_TestCase
{
    protected function getCacheInstance()
    {
        return Cache::connect(['type' => 'Lite', 'path' => CACHE_PATH]);
    }

    /**
     * 测试缓存读取
     * @return  mixed
     * @access public
     */
    public function testGet()
    {
        $cache = $this->getCacheInstance();
        $this->assertFalse($cache->get('test'));
    }

    /**
     * 测试缓存设置
     * @return  mixed
     * @access public
     */
    public function testSet()
    {
        $cache = $this->getCacheInstance();
        $this->assertNotEmpty($cache->set('test', 'test'));
    }

    /**
     * 删除缓存测试
     * @return  mixed
     * @access public
     */
    public function testRm()
    {
        $cache = $this->getCacheInstance();
        $this->assertTrue($cache->rm('test'));
    }

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。