amphp / cache
A fiber-aware cache API based on Amp and Revolt.
Fund package maintenance!
amphp
Installs: 3 641 894
Dependents: 22
Suggesters: 0
Security: 0
Stars: 86
Watchers: 8
Forks: 15
Open Issues: 0
Requires
- php: >=8.1
- amphp/amp: ^3
- amphp/serialization: ^1
- amphp/sync: ^2
- revolt/event-loop: ^1 || ^0.2
Requires (Dev)
- amphp/php-cs-fixer-config: ^2
- amphp/phpunit-util: ^3
- phpunit/phpunit: ^9
- psalm/phar: ^5.4
This package is auto-updated.
Last update: 2023-05-09 21:53:28 UTC
README
AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind.
amphp/cache
specifically provides a cache interface and multiple implementations of it.
Installation
This package can be installed as a Composer dependency.
composer require amphp/cache
Usage
AtomicCache
Cache
<?php
namespace Amp\Cache;
interface Cache
{
public function get(string $key): mixed;
public function set(string $key, mixed $value, int $ttl = null): void;
public function delete(string $key): ?bool;
}
LocalCache
NullCache
Cache implementation that just ignores all operations and always resolves to null
.