realpage/simple-cache

Simple caching based on the proposed PSR-16

v1.0.0-beta 2016-09-02 20:57 UTC

This package is auto-updated.

Last update: 2024-10-24 05:54:14 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Simple implementation of the proposed psr-16 simplecache standard. It is recommended that you familiarize yourself with the proposal when using this package.

Install

Via Composer

$ composer require jlaswell/simple-cache

Usage

Single values

$cache = new Jlaswell\SimpleCache\ArrayCache();
$cache->set('key1' 'value1');
// Do operations
$key1 = $cache->get('key1');

Multiple values

$cache = new Jlaswell\SimpleCache\ArrayCache();
$cache->setMultiple(['key1' => 'value1', 'key2' => 'value2']);
// Do operations
$data = $cache->getMultiple(['key1', 'key2']);

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

Tests for simple-cache are designed to be run against running instances of each of the available drivers. This means that we utilize Docker to run instances of each driver such as redis during testing. The following will start up all of the available drivers and run all of the available tests.

$ docker-compose up -d
$ composer test

simple-cache centralizes most unit tests into a single trait that is used for each driver's unit test. Each unit test simply implements a buildCache method, uses the CacheInterfaceTestCases trait, and tests will be run for that driver. The ArrayCacheTest is a good example to understand the structure and trait usage.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email john.n.laswell+github@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.