Download the PHP package damimpr/cache-multi-layer without Composer
On this page you can find all versions of the php package damimpr/cache-multi-layer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download damimpr/cache-multi-layer
More information about damimpr/cache-multi-layer
Files in damimpr/cache-multi-layer
Package cache-multi-layer
Short Description PHP library used for fast management of a single cache system, or management of multiple systems with priority levels.v
License Apache-2.0
Homepage https://damianoimprota.dev
Informations about the package cache-multi-layer
Cache multi layer
PHP library used for fast management of a single cache system, or management of multiple systems with priority levels.
The management of a single system works like a mask and allows transparent use of the cache by abstracting which one you want to use.
Multi-level management is conceived as a vertical hierarchy, where the highest priority is at the top, and lower priorities are gradually lower down. Write operations are performed on all levels. Read operations are performed by reading from the cache system with the highest priority, and if the data is not found, the next system is read. Whenever a read from a system is successful, the cache systems with higher priority that did not return any value are updated.
The currently implemented caches are:
- Apcu
- Redis
- Memcache
All cache systems support all primitive types (int, float, string) and instances of classes that implement the Cacheable interface. Arrays are also supported, provided that the elements they contain are as described above.
Install
Usage examples
Single cache
example with redis cache
Multi cache level
Example with apcu cache used with maximum priority and redis cache used with lower priority
Contribuiting
If you would like to contribute to this library, there is a docker you can use in development.
The docker image has been developed to execute commands, which are executable through the commands file, and are listed below:
-
Credits
Powerful tools used:
- php-cs-fixer for standard PSR-12 code formatting
- rector for code refactoring
- phpstan for finding bugs