mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-08 23:39:46 +01:00
Merge pull request #863 from vichan-devel/RealAngeleno-patch-16
continued php 7.4 compatibility
This commit is contained in:
commit
8cd4cae56e
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Vichan\Data\Driver;
|
namespace Vichan\Data\Driver;
|
||||||
|
|
||||||
defined('TINYBOARD') or exit;
|
|
||||||
|
|
||||||
|
defined('TINYBOARD') or exit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple process-wide PHP array.
|
* A simple process-wide PHP array.
|
||||||
*/
|
*/
|
||||||
class ArrayCacheDriver implements CacheDriver {
|
class ArrayCacheDriver implements CacheDriver {
|
||||||
private static array $inner = [];
|
private static $inner = [];
|
||||||
|
|
||||||
public function get(string $key): mixed {
|
public function get(string $key) {
|
||||||
return isset(self::$inner[$key]) ? self::$inner[$key] : null;
|
return isset(self::$inner[$key]) ? self::$inner[$key] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set(string $key, mixed $value, mixed $expires = false): void {
|
public function set(string $key, $value, $expires = false): void {
|
||||||
self::$inner[$key] = $value;
|
self::$inner[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,34 +5,34 @@ defined('TINYBOARD') or exit;
|
|||||||
|
|
||||||
|
|
||||||
interface CacheDriver {
|
interface CacheDriver {
|
||||||
/**
|
/**
|
||||||
* Get the value of associated with the key.
|
* Get the value of associated with the key.
|
||||||
*
|
*
|
||||||
* @param string $key The key of the value.
|
* @param string $key The key of the value.
|
||||||
* @return mixed|null The value associated with the key, or null if there is none.
|
* @return mixed|null The value associated with the key, or null if there is none.
|
||||||
*/
|
*/
|
||||||
public function get(string $key): mixed;
|
public function get(string $key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a key-value pair.
|
* Set a key-value pair.
|
||||||
*
|
*
|
||||||
* @param string $key The key.
|
* @param string $key The key.
|
||||||
* @param mixed $value The value.
|
* @param mixed $value The value.
|
||||||
* @param int|false $expires After how many seconds the pair will expire. Use false or ignore this parameter to keep
|
* @param int|false $expires After how many seconds the pair will expire. Use false or ignore this parameter to keep
|
||||||
* the value until it gets evicted to make space for more items. Some drivers will always
|
* the value until it gets evicted to make space for more items. Some drivers will always
|
||||||
* ignore this parameter and store the pair until it's removed.
|
* ignore this parameter and store the pair until it's removed.
|
||||||
*/
|
*/
|
||||||
public function set(string $key, mixed $value, mixed $expires = false): void;
|
public function set(string $key, $value, $expires = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a key-value pair.
|
* Delete a key-value pair.
|
||||||
*
|
*
|
||||||
* @param string $key The key.
|
* @param string $key The key.
|
||||||
*/
|
*/
|
||||||
public function delete(string $key): void;
|
public function delete(string $key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all the key-value pairs.
|
* Delete all the key-value pairs.
|
||||||
*/
|
*/
|
||||||
public function flush(): void;
|
public function flush();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user