Skip to content

Commit

Permalink
fix: cache notification data rather than notification object
Browse files Browse the repository at this point in the history
  • Loading branch information
Dartui committed Jul 12, 2024
1 parent ba5ea41 commit 7ba8a71
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Database/NotificationDatabaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ public static function get($hash)
{
$cache = static::getCache($hash);

$notification = $cache->get();
$notificationData = $cache->get();

if (!$notification instanceof Notification) {
if (!is_array($notificationData)) {
$notificationData = DatabaseService::db()->get_row(
DatabaseService::db()->prepare(
'SELECT * FROM %i WHERE hash = %s',
Expand Down Expand Up @@ -328,12 +328,10 @@ static function ($extras, $data) {
[]
);

$notification = Notification::from('array', $notificationData);

$cache->set($notification);
$cache->set($notificationData);
}

return $notification;
return Notification::from('array', $notificationData);
}

/**
Expand Down

0 comments on commit 7ba8a71

Please sign in to comment.