$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'=>'暫無(wú)數(shù)據(jù)','title'=>'審批中心']);
}
$redis->set($keys,serialize($data));//存數(shù)據(jù)
$redis->expire($keys,3600*5);//緩存時(shí)間5秒
}
$data=unserialize($list);創(chuàng)新互聯(lián)建站專(zhuān)注于企業(yè)全網(wǎng)營(yíng)銷(xiāo)推廣、網(wǎng)站重做改版、淇濱網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、HTML5建站、電子商務(wù)商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)公司、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性?xún)r(jià)比高,為淇濱等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。
$spdata=Config::getConfig('shenpileixing');
foreach($data as $key=>$val){
//編輯數(shù)據(jù)的時(shí)候更新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' =>附件:http://down.51cto.com/data/2368487
array (
'name' => 'yiisoft/yii2-redis',
'version' => '2.2.0.0',
'alias' =>
array (
'@yii/redis' => $vendorDir . '/yiisoft/yii2-redis',
),
),
創(chuàng)新互聯(lián)www.cdcxhl.cn,專(zhuān)業(yè)提供香港、美國(guó)云服務(wù)器,動(dòng)態(tài)BGP最優(yōu)骨干路由自動(dòng)選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨(dú)有T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動(dòng)現(xiàn)已開(kāi)啟,新人活動(dòng)云服務(wù)器買(mǎi)多久送多久。