crazymeeks / phpcacher
A PHP caching library
dev-master
2017-08-13 05:36 UTC
Requires
- predis/predis: ^1.1
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2024-11-13 19:56:06 UTC
README
phpcacher
About
A PHP caching library
- v1.0.0
Requirements
- PHP >= 5.6.*
Supported Drivers
- Files
- apcu v4.0.8
How to Install
- In your composer.json file add this require key:
"require": {
"crazymeeks/phpcacher": "v1.0.0"
}
- Using CLI command, copy and execute this command in the target project or specified folder:
composer require crazymeeks/phpcacher
How to use
<?php
require __DIR__ . '/vendor/autoload.php';
use Crazymeeks\PHPCacher\Cacher;
$cache = new Cacher;
$instance = $cache->setDriver('files');
$data = array('id' => 1, 'name' => 'John Doe');
Store data to cache and expires in 1hr
$data = array('name' => 'John Doe');
$instance->setKey('user')->setItem($data)->expires(3600);
Get Item in the cache
$item = $instance->getItem('user');
Print the item
print_r($item);
?>
Setting Custom Cache Directory
- You can also set your own cache directory where the cache data will be save.
$instance->cache->setDriver('files', '/tmp/'); // For windows users, 'D:/cachetmp' or 'C:/cachetmp'
Report Bug
Email: jeffclaud17@gmail.com
Author
Jeff Claud[jeffclaud17@gmail.com]
Contributors
Aaron Tolentino[aarontolentino123@gmail.com]
Joshua Clifford Reyes
Referrences
- See the WIKI for documentation