g4/russian-doll

russian-doll php library

Installs: 972

Dependents: 0

Stars: 8

Watchers: 4

Forks: 1

Language: PHP

0.3.0 2015-06-29 15:13 UTC

README

russian-doll - caching schema php library - inspired by rails/cache_digests

Install

Install through composer package manager. Find it on packagist.

composer require g4/russian-doll

Dependency:

Usage

Check mcache docs for details - mcache

<?php

$mcache = \G4\Mcache\McacheFactory::createInstance($driverName, $options, $prefix);

$key = \G4\RussianDoll\Key('posts');
$key
    ->addVariablePart($perPage)
    ->addVariablePart($page);

$russianDoll = new \G4\RussianDoll\RussianDoll($mcache);
$russianDoll->setKey($key);

// get data from cache
$posts = $russianDoll->fetch();

// write data to cache
$russianDoll->write($posts);

// invalidate cache entry
$russianDoll->expire();

Development

Install dependencies

$ make install

Run tests

$ make test

License

(The MIT License) see LICENSE file for details...