A key-value JSON-based PSR-16 cache implementation.
Built with:
- PHP-FIG PSR-16: a common interface for caching libraries.
- Psr\SimpleCache: a repository that holds all interfaces related to PSR-16.
- League\Flysystem: a filesystem abstraction that allows to easily swap out a local filesystem for a remote one.
Here our Quality Assurance indicators for master
git branch.
build status | code coverage | code quality | |
---|---|---|---|
Travis CI | |||
CodeCov | |||
Scrutinizer | |||
Code Climate | |||
Codacy |
- In some situations, remote web hosts do not support (or do not allow to install) major cache drivers.
- JSON objects allow to set/get key-value items.
- PHP 5.6 or greater (including 7.0, 7.1 and HHVM)
Make sure you have composer installed.
Then run the following command from your project root:
$ composer require infobiotech/php-json-cache
infobiotech/php-json-cache implements PSR-16 and thus provides a standardized API for storing and retrieving data.
Here is a simple use case:
<?php
require 'vendor/autoload.php';
$flysystemAdapter = new League\Flysystem\Adapter\Local('.');
$jsonCache = new Infobiotech\JsonCache\Psr16\Driver($flysystemAdapter, uniqid());
$jsonCache->set('key', 'value'); // return TRUE
$jsonCache->get('key'); // return 'value'
Due to a deep refactor and restructure, the instantiation code must change from this:
$jsonCache = new Infobiotech\JsonCache(/* your adapter and your namespace */);
to this:
$jsonCache = new Infobiotech\JsonCache\Psr16\Driver(/* your adapter and your namespace */);
The API is unchanged.
- sabre-io/cache - In-memory, APCu and Memcached cache abstraction layer.
- matthiasmullie/scrapbook - Full featured caching environment with several adapters.
- SilentByte/litecache - Lightweight code/opcode caching by generating
*.php
files for cached objects. - kodus/file-cache - Flat-file cache-implementation.
- naroga/redis-cache - A Redis driver implementation.
- paillechat/apcu-simple-cache - APCu implementation.
- kodus/mock-cache - A PSR-16 mock cache for integration testing.
Run the following command from your project root:
$ ./vendor/bin/phpunit
Run the following command from your project root:
$ ./vendor/bin/phpcs src --standard=psr2 -sp
We try to follow SemVer for versioning. For the versions available, see the tags on this repository.
- Alessandro Raffa - Initial work - infobiotech
Contributions are welcome and will be credited.
Please read CONTRIBUTING.md for details on our code of conduct.
This project is licensed under the MIT License - see the LICENSE.md file for details