2017 © Pedro Peláez
 

library cache

A minimalistic cache adapter interface library

image

onoi/cache

A minimalistic cache adapter interface library

  • Saturday, January 27, 2018
  • by mwjames
  • Repository
  • 1 Watchers
  • 2 Stars
  • 137,559 Installations
  • PHP
  • 10 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

Cache

Build Status Code Coverage Scrutinizer Code Quality Latest Stable Version Packagist download count Dependency Status, (*1)

A minimalistic cache adapter interface that was part of the Semantic MediaWiki code base and is now being deployed as independent library., (*2)

  • Support for MediaWiki's BagOStuff cache interface
  • Support for the Doctrine cache interface
  • Support for the Zend cache (ZF2) interface
  • Provides a FixedInMemoryLruCache array LRU cache without any external cache provider dependency
  • Provides a CompositeCache to combine different cache instances and allow access through hierarchical iteration on a first-come first-served basis

Requirements

PHP 5.3 / HHVM 3.3 or later, (*3)

Installation

The recommended installation method for this library is by either adding the dependency to your composer.json., (*4)

{
    "require": {
        "onoi/cache": "~1.1"
    }
}

Usage

use Onoi\Cache\Cache;

class Foo {

    private $cache = null;

    public function __constructor( Cache $cache ) {
        $this->cache = $cache;
    }

    public function doSomething( $id ) {

        if ( $this->cache->contains( $id ) ) {
            // do something
        }
    }
}
$cacheFactory = new CacheFactory();

$instance = new Foo( $cacheFactory->newFixedInMemoryLruCache( 500 ) );
$instance->doSomething( 'bar' );

or

$compositeCache = $cacheFactory->newCompositeCache( array(
    $cacheFactory->newFixedInMemoryLruCache( 500 ),
    $cacheFactory->newDoctrineCache( new \Doctrine\Common\Cache\RedisCache() ),
    $cacheFactory->newMediaWikiCache( new \SqlBagOStuf() )
) );

$instance = new Foo( $compositeCache );
$instance->doSomething( 'bar' );

Contribution and support

If you want to contribute work to the project please subscribe to the developers mailing list and have a look at the contribution guidelinee. A list of people who have made contributions in the past can be found here., (*5)

Tests

The library provides unit tests that covers the core-functionality normally run by the continues integration platform. Tests can also be executed manually using the composer phpunit command from the root directory., (*6)

Release notes

  • 1.2.0 (2015-06-02), (*7)

    • Added Cache::getName
    • Removed deprecated FixedInMemoryCache
  • 1.1.0 (2015-03-29), (*8)

    • Added NullCache
    • Added ZendCache
    • Renamed FixedInMemoryCache to FixedInMemoryLruCache
  • 1.0.0 (2015-01-16), (*9)

    • Initial release

License

GNU General Public License 2.0 or later., (*10)

The Versions

27/01 2018

dev-master

9999999-dev https://github.com/onoi/cache

A minimalistic cache adapter interface library

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

  • php >=5.3.2

 

cache

14/12 2015

dev-callback

dev-callback https://github.com/onoi/cache

A minimalistic cache adapter interface library

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.2

 

cache

02/06 2015

1.2.0

1.2.0.0 https://github.com/onoi/cache

A minimalistic cache adapter interface library

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.2

 

cache

29/03 2015

1.1.0

1.1.0.0 https://github.com/onoi/cache

A minimalistic cache adapter interface library

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.2

 

cache

16/01 2015

1.0.0

1.0.0.0 https://github.com/onoi/cache

A minimalistic cache interface library

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.2

 

cache