Download the PHP package decodelabs/stash without Composer
On this page you can find all versions of the php package decodelabs/stash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download decodelabs/stash
More information about decodelabs/stash
Files in decodelabs/stash
Package stash
Short Description PSR6 / PSR16 cache handler
License MIT
Informations about the package stash
Stash
Cache storage system
Stash provides a PSR6 / PSR16 compatible cache system for PHP.
Installation
Usage
Store and access data in a standardised volatile cache either via the PSR6 or PSR16 interface mechanisms. Caches are namespaced to allow for clean separation of data between usage domains.
Fetch
Use the fetch method to ensure a cache value is in place in one call:
Array Access
Array access methods provide quick offset access to cache data:
Object access
Object access works the same way as ArrayAccess, but with the PSR6 Cache Item object as the return:
Drivers
The following drivers are available out of the box:
- Memcache
- Redis
- Predis (native PHP redis client)
- APCu
- File (serialized data)
- PhpFile (var_export data)
- PhpArray (in memory)
- Blackhole (nothing stored)
However, Stash uses Archetype to load driver classes so additional drivers may be provided by implementing your own Resolver
.
By default, Stash will use the best-fit driver for your environment, starting with Memcache, through Redis and APCu, and falling back on the File store.
Configuration
All drivers have default configuration to allow them to work out of the box, however Stash provides the ability to implement your own configuration loader so that you can control drivers and settings on a per-namespace basis
Implement the following interface however your system requires; all nullable methods can just return null to use default configuration:
Then tell Stash about your configuration provider:
Custom Store methods
By default, newly loaded caches use a generic Store implementation, however if you require custom methods for domain-oriented data access, you can implement your own Store classes using a custom Archetype Resolver
.
Licensing
Stash is licensed under the MIT License. See LICENSE for the full license text.
All versions of stash with dependencies
decodelabs/archetype Version ^0.3.8
decodelabs/atlas Version ^0.12.3
decodelabs/coercion Version ^0.3
decodelabs/dictum Version ^0.6.9
decodelabs/exceptional Version ^0.5.3
decodelabs/glitch-support Version ^0.5.1
decodelabs/veneer Version ^0.12.3
psr/cache Version ^3.0
psr/simple-cache Version ^3.0
nesbot/carbon Version ^2|^3