Rename the key for the cache. #689
This commit is contained in:
parent
7b1b56c899
commit
33ae3b624d
2 changed files with 9 additions and 9 deletions
|
|
@ -247,7 +247,7 @@ services:
|
|||
App\Service\JobOrderJsonCache:
|
||||
arguments:
|
||||
$redis_prov: "@App\\Service\\RedisClientProvider"
|
||||
$jo_json_info_key: "%env(JO_JSON_INFO_KEY)%"
|
||||
$jo_json_cache_key: "%env(JO_JSON_CACHE_KEY)%"
|
||||
|
||||
# inventory manager
|
||||
App\Service\InventoryManager:
|
||||
|
|
|
|||
|
|
@ -7,19 +7,19 @@ use App\Service\RedisClientProvider;
|
|||
class JobOrderJsonCache
|
||||
{
|
||||
protected $redis;
|
||||
protected $jo_json_info_key;
|
||||
protected $jo_json_cache_key;
|
||||
|
||||
public function __construct(RedisClientProvider $redis_prov, $jo_json_info_key)
|
||||
public function __construct(RedisClientProvider $redis_prov, $jo_json_cache_key)
|
||||
{
|
||||
$this->redis = $redis_prov->getRedisClient();
|
||||
$this->jo_json_info_key = $jo_json_info_key;
|
||||
$this->jo_json_cache_key = $jo_json_cache_key;
|
||||
}
|
||||
|
||||
public function addJOJsonInfo($jo_id, $jo_data)
|
||||
{
|
||||
$key = $jo_id;
|
||||
|
||||
$this->redis->hset($this->jo_json_info_key, $key, $jo_data);
|
||||
$this->redis->hset($this->jo_json_cache_key, $key, $jo_data);
|
||||
}
|
||||
|
||||
public function findJOJsonInfo($jo_id)
|
||||
|
|
@ -29,11 +29,11 @@ class JobOrderJsonCache
|
|||
$key = $jo_id;
|
||||
|
||||
// check if JO id is in redis hash
|
||||
$is_exist = $this->redis->hexists($this->jo_json_info_key, $key);
|
||||
$is_exist = $this->redis->hexists($this->jo_json_cache_key, $key);
|
||||
if ($is_exist)
|
||||
{
|
||||
// get the data
|
||||
$jo_data = $this->redis->hget($this->jo_json_info_key, $key);
|
||||
$jo_data = $this->redis->hget($this->jo_json_cache_key, $key);
|
||||
}
|
||||
|
||||
return $jo_data;
|
||||
|
|
@ -44,10 +44,10 @@ class JobOrderJsonCache
|
|||
$key = $jo_id;
|
||||
|
||||
// check if JO id is in redis hash
|
||||
$is_exist = $this->redis->hexists($this->jo_json_info_key, $key);
|
||||
$is_exist = $this->redis->hexists($this->jo_json_cache_key, $key);
|
||||
if ($is_exist)
|
||||
{
|
||||
$this->redis->hdel($this->jo_json_info_key, $key);
|
||||
$this->redis->hdel($this->jo_json_cache_key, $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue