1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-20 03:15:57 +01:00
vichan/inc/Data/Driver/ApcuCacheDriver.php
2024-10-10 23:10:05 +02:00

29 lines
544 B
PHP

<?php
namespace Vichan\Data\Driver;
defined('TINYBOARD') or exit;
class ApcuCacheDriver implements CacheDriver {
public function get(string $key): mixed {
$success = false;
$ret = \apcu_fetch($key, $success);
if ($success === false) {
return null;
}
return $ret;
}
public function set(string $key, mixed $value, mixed $expires = false): void {
\apcu_store($key, $value, (int)$expires);
}
public function delete(string $key): void {
\apcu_delete($key);
}
public function flush(): void {
\apcu_clear_cache();
}
}