Commit 0645735f by 杨树贤

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

parent dc2ad983
...@@ -63,6 +63,7 @@ DB_PREFIX=lie_ ...@@ -63,6 +63,7 @@ DB_PREFIX=lie_
REDIS_HOST=192.168.1.235 REDIS_HOST=192.168.1.235
REDIS_PASSWORD=icDb29mLy2s REDIS_PASSWORD=icDb29mLy2s
REDIS_PORT=6379 REDIS_PORT=6379
REDIS_PREFIX=LC_
REDIS_READ_HOST=192.168.1.237 REDIS_READ_HOST=192.168.1.237
REDIS_READ_PASSWORD=icDb29mLy2s REDIS_READ_PASSWORD=icDb29mLy2s
......
...@@ -61,16 +61,17 @@ class SelfBrandModel extends Model ...@@ -61,16 +61,17 @@ class SelfBrandModel extends Model
{ {
$expireMinutes = 5; $expireMinutes = 5;
//先去缓存里面取
$Redis = new RedisModel;
$brandList = $Redis->hgetall('Self_Brand');
if (!$brandList) {
return Cache::remember('brandList_' . json_encode($map), $expireMinutes, function () use ($map) { return Cache::remember('brandList_' . json_encode($map), $expireMinutes, function () use ($map) {
$field = [ $field = [
'brand_id', 'brand_id',
'brand_name', 'brand_name',
'brand_logo', 'brand_logo',
'create_time',
'brand_area', 'brand_area',
'brand_brief',
]; ];
$query = $this->select($field)->where('status', 1); $query = $this->select($field)->where('status', 1);
if (!empty($map['brand_area'])) { if (!empty($map['brand_area'])) {
...@@ -81,4 +82,7 @@ class SelfBrandModel extends Model ...@@ -81,4 +82,7 @@ class SelfBrandModel extends Model
return $query->get()->toArray(); return $query->get()->toArray();
}); });
} }
return $brandList;
}
} }
...@@ -343,8 +343,10 @@ return [ ...@@ -343,8 +343,10 @@ return [
*/ */
'redis' => [ 'redis' => [
'options' => [
'cluster' => env('REDIS_CLUSTER', false), 'cluster' => env('REDIS_CLUSTER', false),
'prefix' => env('REDIS_PREFIX'),
],
'default' => [ 'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'), 'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null), '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