Skip to content

Commit

Permalink
System: expose query error on database cache driver
Browse files Browse the repository at this point in the history
  • Loading branch information
esyede committed Sep 11, 2024
1 parent 89b5ea7 commit 93a2b12
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions system/cache/drivers/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,12 @@ public function put($key, $value, $minutes)
$key = $this->key . $key;
$value = serialize($value);
$expiration = $this->expiration($minutes);
$record = $this->table()->where('key', $key);

try {
if ($record->first()) {
$record->update(compact('value', 'expiration'));
} else {
$this->table()->insert(compact('key', 'value', 'expiration'));
} catch (\Throwable $e) {
$this->table()->where('key', '=', $key)->update(compact('value', 'expiration'));
} catch (\Exception $e) {
$this->table()->where('key', '=', $key)->update(compact('value', 'expiration'));
}
}

Expand Down

0 comments on commit 93a2b12

Please sign in to comment.