sabre / cache
Simple cache abstraction layer implementing PSR-16
Installs: 765 997
Dependents: 1
Suggesters: 0
Security: 0
Stars: 54
Watchers: 13
Forks: 10
Open Issues: 9
Requires
- php: ^7.4 || ^8.0
- psr/simple-cache: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.63
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.12
- phpstan/phpstan-phpunit: ^1.4
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^9.6
Provides
This package is auto-updated.
Last update: 2024-10-31 02:07:29 UTC
README
This repository is a simple abstraction layer for key-value caches. It implements PSR-16.
If you need a super-simple way to support PSR-16, sabre/cache helps you get started. It's as hands-off as possible.
It also comes with a test-suite that can be used by other PSR-16 implementations.
Installation
Make sure you have composer installed, and then run:
composer require sabre/cache
Usage
Read PSR-16 for the API. We follow it to the letter.
In-memory cache
This is useful as a test-double for long-running processes. The Memory
cache
only lasts as long as the object does.
$cache = new \Sabre\Cache\Memory();
APCu cache
This object uses the APCu api for caching. It's a fast memory cache that's shared by multiple PHP processes.
$cache = new \Sabre\Cache\Apcu();
Memcached cache
This object uses the Memcached extension for caching.
$memcached = new \Memcached(); $memcached->addServer('127.0.0.1', 11211); $cache = new \Sabre\Cache\Memcached($memcached);
You are responsible for configuring memcached, and you just pass a fully
instantiated objected to the \Sabre\Cache\Memcached
constructor.
Build status
Questions?
Head over to the sabre/dav mailinglist, or you can also just open a ticket on GitHub.
Made at fruux
This library is being developed by fruux. Drop us a line for commercial services or enterprise support.