apix/simple-cache

The PSR-16 extension to Apix-Cache.

1.0.0 2017-05-03 16:27 UTC

README

Latest Stable Version Build Status Code Quality Code Coverage License Build Status

Apix-SimpleCache provides PSR-16 to Apix-Cache permitting easy caching and invalidation...

  • Fully unit-tested and compliant with PSR-1, PSR-2, PSR-4 and PSR-16.
  • Continuously integrated with PHP 5.3, 5.4, 5.5, 5.6, 7.* and HHVM.

Pull requests and ★ Stars are always welcome. For bugs and feature request, please create an issue.

Basic usage

  use Apix\SimpleCache;

  $client = new \Redis();
  #$client = new \PDO('sqlite:...');    // Any supported client object e.g. Memcached, MongoClient, ...
  #$client = new Cache\Files($options); // or one that implements Apix\Cache\Adapter
  #$client = 'apc';                     // or an adapter name (string) e.g. "APC", "Runtime"
  #$client = new MyArrayObject();       // or even a plain array() or \ArrayObject.

  $cache = SimpleCache\Factory::getPool($client);           // without tagging support
  #$cache = SimpleCache\Factory::getTaggablePool($client);  // with tagging
    
  if ( !$cache->has('wibble_id') ) {
    $data = compute_slow_and_expensive_stuff();
    $cache->set('wibble_id', $data);
  }

  return $cache->get('wibble_id');

Installation

This project adheres to Semantic Versioning and can be installed using composer:

$ composer require apix/simple-cache:1.0.*

All notable changes to this project are documented in its CHANGELOG.

License

This work is licensed under the New BSD license -- see the LICENSE for the full details.
Copyright (c) 2010-2017 Franck Cassedanne