Cache system

v1.0 2015-06-04 08:07 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:17:26 UTC


README

Cache system

Cache system

With this package you can cache any data in any storage.

Installation

Add FivePercent/Cache in your composer.json:

{
    "require": {
        "fivepercent/cache": "~1.0"
    }
}

Now tell composer to download the library by running the command:

$ php composer.phar update fivepercent/cache

Basic usage

Available storage:

  1. ArrayCache

    Cache data in internal array. Will be destroyed after ended script.

  2. RedisCache

    Cache data in Redis storage. Store data in HASH type.

  3. ChainCache
  4. NullCache

Examples:

use FivePercent\Component\Cache\ArrayCache;

$cache = new ArrayCache();

if (!$cache->has('my_key')) {
    $cache->set('my_key', 'My Value');
}

print $cache->get('my_key'); // Printing "My Value"

Symfony2

If you use Symfony2 Framework, you can use CacheClearer for clear cache.

Symfony2 ExpressionLanguage

If you use ExpressionLanguage (Symfony Component), you can use ParserCache for store ExpressionLanguage expression.