soneritics/cache

Caching mechanism with support for multiple caching types.

dev-master 2015-03-23 09:23 UTC

This package is auto-updated.

Last update: 2024-10-23 18:20:02 UTC


README

Build Status Coverage Status License

by

Introduction

Caching interfaces and implementation of caching methods.

Minimum Requirements

  • PHP 5.5+

Features

Currently supports the following caches:

  • TextCache
  • FileCache
  • MemCache
  • ArrayCache
  • SessionCache

Example

$textCache = (new TextCache('tmp'))
    ->setCacheExpiration(4)
    ->set('test', 'test');

echo $textCache->get('test');
// sleep(5);
// $textCache->has('test') === false

$fileCache = (new FileCache('tmp'))
    ->setCacheExpiration(3600)
    ->set('test', ['test1', 'test2']);

var_dump($fileCache->get('test'));
$fileCache->clear('test');