Closed ericp1337 closed 7 years ago
I've managed to rewrite the following in order to support multiple database systems
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);
}
/*
* Operator is - so decrement
*/
return $sql
->decrement($config['field'], $amount);
}
But am having trouble figuring out if the rebuildCacheRecord
can be rewritten using the DB class.
It would be nice if someone could figure out a way to do this so that this project's cache behavior can be used on all supported laravel databases.
Interesting, I wasn't aware (obviously) that would be an issue in PSQL.
Let's definitely look at correcting that. Would you like to start a PR?
Here's what I've come up with so far. https://github.com/computerfr33k/eloquence/commit/acf8407b2f0e1ea2aec0370fb5a821a38fa03caa
Is MySQL/MariaDB the only supported database? Because I tried to use the countCache with postgresql and the syntax is not compatible since it doesn't like the tilda (`)