amphp/cache
A fiber-aware cache API based on Amp and Revolt.
Fund package maintenance!
v2.0.1
2024-04-19 03:38 UTC
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
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 46912e387e6aa94933b61ea1ead9cf7540b7797c
- Niklas Keller <me.woop@kelunik.com>
- Aaron Piotrowski <aaron.woop@trowski.com>
- Daniel Lowrey <rdlowrey.woop@php.net>
This package is auto-updated.
Last update: 2026-06-09 10:17:16 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.
👁 Latest Release
👁 MIT License
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.
