您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
$redis = Yii::$app->redis;
$keys = 'dll_mb_examine';//定义键名
$list = $redis->get($keys);//取key值
if(empty($list)){
$data=Examine::getMobileExamine($userInfo['userId']);
if(empty($data)){
return $this->redirect(['/frontend/default/nomsg','msg'=>'暂无数据','title'=>'审批中心']);
}
$redis->set($keys,serialize($data));//存数据
$redis->expire($keys,3600*5);//缓存时间5秒
}
$data=unserialize($list);
$spdata=Config::getConfig('shenpileixing');
foreach($data as $key=>$val){
//编辑数据的时候更新redis缓存
$key=Yii::$app->params['cache_key']['cyj_info'].$data['earnestId'];
if(!empty($key)){
Yii::$app->cache->delete($key);
}
web.php文件里引入redis
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'pQwkcmQwaDnwv2kQIEpshK2XCYfAilIf',
],
'assetManager' => [
'linkAssets' => true,
],
'cache' => [
// 'class' => 'yii\caching\FileCache',
'class' => 'yii\redis\Cache',
],
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => '192.168.0.227',
'port' => 6379,
'database' => 0,
],
yiisoft/extensions.php 尾部追加:
'yiisoft/yii2-redis' =>
array (
'name' => 'yiisoft/yii2-redis',
'version' => '2.2.0.0',
'alias' =>
array (
'@yii/redis' => $vendorDir . '/yiisoft/yii2-redis',
),
),
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。