public function updateCacheRecord(array $config, $operation, $amount, $foreignKey)
{
if (is_null($foreignKey)) {
return;
}
$config = $this->processConfig($config);
$sql = DB::table($config['table'])->where($config['key'], $foreignKey);
/*
* Increment for + operator
*/
if ($operation == '+') {
return $sql->increment($config['field'], $amount);
}
/*
* Decrement for - operator
*/
return $sql->decrement($config['field'], $amount);
}