28 lines
826 B
PHP
28 lines
826 B
PHP
<?php
|
|
// MemcachedProvider.php
|
|
// Created: 2024-04-10
|
|
// Updated: 2024-04-10
|
|
|
|
namespace Index\Cache\Memcached;
|
|
|
|
use Index\Cache\ICacheProvider;
|
|
|
|
/**
|
|
* Base Memcached provider implementation.
|
|
*/
|
|
abstract class MemcachedProvider implements ICacheProvider {
|
|
public const MAX_TTL = 30 * 24 * 60 * 60;
|
|
|
|
public abstract function get(string $key): mixed;
|
|
public abstract function set(string $key, mixed $value, int $ttl = 0): void;
|
|
public abstract function delete(string $key): void;
|
|
public abstract function touch(string $key, int $ttl = 0): void;
|
|
public abstract function increment(string $key, int $amount = 1): int;
|
|
public abstract function decrement(string $key, int $amount = 1): int;
|
|
public abstract function close(): void;
|
|
|
|
public function __destruct() {
|
|
$this->close();
|
|
}
|
|
}
|