adrorocker / tinycache
A simple library to cache assets and html page
0.1.0
2017-01-30 00:57 UTC
Requires
- php: >= 5.6
- psr/cache: ^1.0
Requires (Dev)
- phpunit/phpunit: 5.6.*
This package is auto-updated.
Last update: 2024-11-26 06:30:09 UTC
README
A small library to cache assets and html pages.
Installation
composer require adrorocker/tinycache
Usage
require '../vendor/autoload.php'; use TinyCache\Cache; use TinyCache\Item; use TinyCache\Adapter\FilesystemAdapter; $cache = new Cache(new FilesystemAdapter); $item1 = new Item('key1','Hola uno'); $item2 = new Item('key2','Hola dos'); $cache->save($item1) // You can 'add' an Item to the cache collection before it is actually saved on the pool $cache->saveDeferred($item2); // Then commit to save the items on the pool $cache->commit(); // Get an Item from the pool $item = $cache->getItem('key1'); // Get several Items from the pool $items = $cache->getItems(['key1','key2']); // Delete on Item from the pool $cache->deleteItem('key1'); // Delete several Items from the pool $cache->deleteItems(['key1','key2']); // Delete all Items from the pool $cache->clear();