1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-02 21:07:20 +01:00
vichan/inc/Data/Driver/CacheDriver.php

39 lines
1.2 KiB
PHP
Raw Normal View History

2024-10-02 21:49:51 +02:00
<?php
namespace Vichan\Data\Driver;
defined('TINYBOARD') or exit;
interface CacheDriver {
2024-12-22 14:42:16 -06:00
/**
* Get the value of associated with the key.
*
* @param string $key The key of the value.
* @return mixed|null The value associated with the key, or null if there is none.
*/
public function get(string $key);
2024-10-02 21:49:51 +02:00
2024-12-22 14:42:16 -06:00
/**
* Set a key-value pair.
*
* @param string $key The key.
* @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
* 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.
*/
public function set(string $key, $value, $expires = false);
2024-10-02 21:49:51 +02:00
2024-12-22 14:42:16 -06:00
/**
* Delete a key-value pair.
*
* @param string $key The key.
*/
public function delete(string $key);
2024-10-02 21:49:51 +02:00
2024-12-22 14:42:16 -06:00
/**
* Delete all the key-value pairs.
*/
public function flush();
2024-10-02 21:49:51 +02:00
}