Commit 0645735f by 杨树贤

修改redis前缀以及品牌直接读取缓存

parent dc2ad983
......@@ -63,6 +63,7 @@ DB_PREFIX=lie_
REDIS_HOST=192.168.1.235
REDIS_PASSWORD=icDb29mLy2s
REDIS_PORT=6379
REDIS_PREFIX=LC_
REDIS_READ_HOST=192.168.1.237
REDIS_READ_PASSWORD=icDb29mLy2s
......
......@@ -61,24 +61,28 @@ class SelfBrandModel extends Model
{
$expireMinutes = 5;
return Cache::remember('brandList_' . json_encode($map), $expireMinutes, function () use ($map) {
$field = [
'brand_id',
'brand_name',
'brand_logo',
'create_time',
'brand_area',
'brand_brief',
];
//先去缓存里面取
$Redis = new RedisModel;
$brandList = $Redis->hgetall('Self_Brand');
if (!$brandList) {
return Cache::remember('brandList_' . json_encode($map), $expireMinutes, function () use ($map) {
$field = [
'brand_id',
'brand_name',
'brand_logo',
'brand_area',
];
$query = $this->select($field)->where('status', 1);
$query = $this->select($field)->where('status', 1);
if (!empty($map['brand_area'])) {
$areaIds = explode(',', $map['brand_area']);
$query->whereIn('brand_area', $areaIds);
}
if (!empty($map['brand_area'])) {
$areaIds = explode(',', $map['brand_area']);
$query->whereIn('brand_area', $areaIds);
}
return $query->get()->toArray();
});
}
return $query->get()->toArray();
});
return $brandList;
}
}
......@@ -343,8 +343,10 @@ return [
*/
'redis' => [
'cluster' => env('REDIS_CLUSTER', false),
'options' => [
'cluster' => env('REDIS_CLUSTER', false),
'prefix' => env('REDIS_PREFIX'),
],
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment