Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

RNGR/Cache

Repository files navigation

RNGR\Cache

Travis Scrutinizer Coverage Status Software License

Simple PHP Cache library

Usage

// Array will not persist
// it will be removed after execution
$storage = new ArrayStorage();

// Or using the Redis PHP extension
// $redis = new \Redis();
// $redis->connect('127.0.0.1', 6379);
// $storage = new RedisExtensionStorage($redis, 'prefix');

$repository = new Repository($storage);

// set value
$repository->set('key', 'value');

// read value
$value = $repository->read('key');

// read and delete value
$value = $repository->readAndDelete('key');

// check if value exists
$exists = $repository->has('key');