2017 © Pedro Peláez
 

library any-cache

Adapter designed to add Framework Agnosticism for Caching within PHP Packages.

image

darrynten/any-cache

Adapter designed to add Framework Agnosticism for Caching within PHP Packages.

  • Monday, June 18, 2018
  • by darrynten
  • Repository
  • 4 Watchers
  • 7 Stars
  • 10,680 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 5 Versions
  • 55 % Grown

The README.md

any-cache

Travis Build Status StyleCI Status codecov Packagist Version MIT License, (*1)

Adapter designed to add Framework Agnosticism for Caching within PHP Packages., (*2)

Supports PHP 5.6+, (*3)

Install

composer require darrynten/any-cache

Goal

Allow package developers to use whichever caching mechanisms are native to whichever framework it is installed in via a simple interface., (*4)

Can be passed an artifact, but can also autodetect its host framework., (*5)

Passing in takes precedence and allows developers to use a specific framework but with a totally different cache library or configuration., (*6)

Details

Package creators can include AnyCache in their packages and leverage supported host framework native caching capabilities., (*7)

AnyCache auto-detects its host framework and does not require any extra configuration, although it also allows passing in a desired cache., (*8)

If none is provided or if there is no caching available, then a local temporary ArrayCache is created and will be used by default. This is transient and not persistent., (*9)

This allows you to not have any additional caching requirements in your packages while allowing you to leverage whichever caching constructs are already in place., (*10)

Supported Frameworks

  • [x] Temporary Array (default)
  • [x] Laravel
  • [x] Symfony
  • [x] Doctrine
  • [x] Psr6
  • [ ] CodeIgniter (partially complete)
  • [ ] ...

Supported Cache Calls

  • [x] get ($key, $default)
  • [x] set ($key, $value, $time)
  • [x] has ($key)
  • [x] pull ($key)
  • [ ] forever ($key, $value)
  • [ ] ...

Provides

Create a new instance., (*11)

use DarrynTen\AnyCache;

$this->cache = new AnyCache()

Call, (*12)

$key = 'foo';
$value = 'bar';
$time = 60;

// Set a value
$this->cache()->set($key, $value, $time);

// Get a cached value
$result = $this->cache()->get($key);

// Check if a key exists
if ($this->cache->has($key)) {
  //
}

// Get and unset
$result = $this->cache()->pull($key);

Notes

The CodeIgniter support is not complete, and it does not auto-detect this framework at this time., (*13)

Missing Tests

The Laravel tests are not 100% complete, there is an issue with testing the Cache Facade on the get method., (*14)

The factory does not have unit test coverage at this point in time., (*15)

The main class is also not tested yet., (*16)

Acknowledgments

The Versions

18/06 2018

dev-composer-update

dev-composer-update https://github.com/darrynten/any-cache

Adapter designed to add Framework Agnosticism for Caching within PHP Packages.

  Sources   Download

MIT

The Requires

  • php ^5.5.9 || ^7.1

 

The Development Requires

cache adapter framework agnostic

17/03 2017

dev-master

9999999-dev https://github.com/darrynten/any-cache

Adapter designed to add Framework Agnosticism for Caching within PHP Packages.

  Sources   Download

MIT

The Requires

  • php ^5.5.9 || ^7.0

 

The Development Requires

cache adapter framework agnostic

17/02 2017

dev-dev

dev-dev https://github.com/darrynten/any-cache

Adapter designed to add Framework Agnosticism for Caching within PHP Packages.

  Sources   Download

MIT

The Requires

  • php ^5.5.9 || ^7.0

 

The Development Requires

cache adapter framework agnostic

09/02 2017

v1.0.1

1.0.1.0 https://github.com/darrynten/any-cache

Adapter designed to add Framework Agnosticism for Caching within PHP Packages.

  Sources   Download

MIT

The Requires

  • php ^5.5.9 || ^7.0

 

The Development Requires

cache adapter framework agnostic

09/02 2017

v1.0.0

1.0.0.0

Adapter designed to add Framework Agnosticism for Caching within PHP Packages.

  Sources   Download

The Requires

  • php ^5.5.9 || ^7.0

 

The Development Requires