Resolve "Optimize SQL call in getJobOrderInfo" #1616

Open
korina.cordero wants to merge 6 commits from 689-optimize-sql-call-in-getjoborderinfo into master
2 changed files with 9 additions and 9 deletions
Showing only changes of commit 33ae3b624d - Show all commits

View file

@ -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:

View file

@ -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);
}
}
}