gigabyte/cache

PHP Cache Library

dev-master 2016-02-18 14:27 UTC

This package is auto-updated.

Last update: 2024-10-27 08:55:08 UTC


README

You can install Extreme PHP Cache either via package download from github or via composer install. I encourage you to do the latter:

{ 
  "require": {
    "gigabyte/cache": "dev-master"
  }
} 

This PHP library makes it easy to cache any php object to the cache with the specific parameters. Currently it only support file system cache.

Basic usage

namespace gigabyte\cache;

$cache_config = new CacheConfig();
$cache_config->setCacheModule('search result')
        ->setIntervalInDay(2)
        ->setCacheFilter(array('serach' => $serach, 'param1' => $value1, 'param2' => $value2));
$cache = CacheFactory::createFileCache($cache_config,"mycache/");
if ($cache->checkCache()) {
    $search_result = $cache->readCache();
} else {
    //calculate $search_result
    $cache->writeCache($search_result);
}