Skip to content

Commit

Permalink
Fix ttl in filecache, v2.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNN1 committed Jan 18, 2023
1 parent 9d589cd commit c7f8f90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace RobiNN\Cache;

class Cache {
final public const VERSION = '2.4.5';
final public const VERSION = '2.4.6';

private readonly CacheInterface $cache;

Expand Down
4 changes: 4 additions & 0 deletions src/Storages/FileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public function get(string $key): mixed {
public function ttl(string $key): int {
$data = $this->getRaw($key);

if ($data['expire'] === 0) {
return 0;
}

return $data['time'] + $data['expire'] - time();
}

Expand Down

0 comments on commit c7f8f90

Please sign in to comment.