byjg / cache-engine
A multi-purpose cache engine PSR-6 and PSR-16 implementation with several drivers.
Fund package maintenance!
byjg
Installs: 51 474
Dependents: 9
Suggesters: 2
Security: 0
Stars: 10
Watchers: 3
Forks: 3
Open Issues: 0
Requires
- php: >=8.1 <8.4
- psr/cache: ^1.0|^2.0|^3.0
- psr/container: ^1.0|^1.1|^2.0
- psr/log: ^1.0|^1.1|^2.0
- psr/simple-cache: ^1.0|^2.0
Requires (Dev)
- phpunit/phpunit: ^9.6
- vimeo/psalm: ^5.9
Suggests
- ext-memcached: *
- ext-redis: *
- ext-shmop: *
Provides
README
A multipurpose cache engine PSR-6 and PSR-16 implementation with several drivers.
PSR-16
PSR-16 defines a Simple Cache interface with less verbosity than PSR-6. Below a list of engines available in this library that is PSR-16 compliant:
PSR-16 Getting Started: here
PSR-6
The PSR-6 implementation use the engines defined above. PSR-6 is more verbosity and have an extra layer do get and set the cache values.
You can use one of the factory methods to create a instance of the CachePool implementation:
PSR-6 Getting Started: here
List of Cache Engines
Logging cache commands
You can add a PSR Log compatible to the constructor in order to get Log of the operations
See log examples here
Use a PSR-11 container to retrieve the cache keys
You can use a PSR-11 compatible to retrieve the cache keys.
See more here
Beyond the PSR protocol
The PSR protocol is a good way to standardize the cache access, but sometimes you need to go beyond the protocol.
Some cache engines have additional features that are not covered by the PSR protocol.
Some examples are:
Install
Just type:
composer require "byjg/cache-engine"
Running Unit Testes
vendor/bin/phpunit --stderr
Note: the parameter --stderr
after phpunit
is to permit run the tests on SessionCacheEngine.