參考教程:https://www.cnblogs.com/pyspang/p/11185759.html、
<?php
namespace app\index\controller;
use think\Cache;
class Index
{
public function index()
{
Cache::store('file')->set('file_test', 969);
Cache::store('file')->set('file_test2', 5656);
// phpinfo();
//方式一
Cache::store('redis')->set('test', array('k1'=>123));
$data = Cache::store('redis')->get('test');
var_dump($data);
//方式二
$redis=new \Redis();
$redis->connect("127.0.0.1","6379");
$redis->set('name','33333');
echo $redis->get('name');
}
}