g4/russian-doll

russian-doll php library

0.4.6 2019-09-06 06:22 UTC

This package is not auto-updated.

Last update: 2024-11-02 06:54:03 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...