1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-02 12:57:35 +01:00
vichan/inc/Data/Driver/ArrayCacheDriver.php

29 lines
535 B
PHP
Raw Normal View History

2024-10-02 21:49:51 +02:00
<?php
namespace Vichan\Data\Driver;
2024-12-22 14:37:22 -06:00
defined('TINYBOARD') or exit;
2024-10-02 21:49:51 +02:00
/**
* A simple process-wide PHP array.
*/
class ArrayCacheDriver implements CacheDriver {
2024-12-22 14:37:22 -06:00
private static $inner = [];
2024-10-02 21:49:51 +02:00
2024-12-22 14:37:22 -06:00
public function get(string $key) {
2024-10-02 21:49:51 +02:00
return isset(self::$inner[$key]) ? self::$inner[$key] : null;
}
2024-12-22 14:37:22 -06:00
public function set(string $key, $value, $expires = false): void {
2024-10-02 21:49:51 +02:00
self::$inner[$key] = $value;
}
public function delete(string $key): void {
unset(self::$inner[$key]);
}
public function flush(): void {
self::$inner = [];
}
}