battis / simplecache
Manage a simple cache backed by a MySQL database
Installs: 238
Dependents: 7
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 2
pkg:composer/battis/simplecache
README
Manage a simple cache backed by a MySQL database
Install
In your composer.json
add:
"require": { "battis/simplecache": "1.*" }
Use
Create a cache:
$mysqli = new mysqli('localhost', 'bob', 's00pers3kr3t', 'app-db'); // or whatever your credentials are $cache = new \Battis\SimpleCache($mysqli);
Basic workflow using cached data (check the cache and used cached data if there, otherwise build data and cache it for next time):
$data = $cache->getCache('foo'); if ($data === false) { // ... lots and lots of work to create $data from scratch $cache->setCache('foo', $data); // cache for next use }
Full API documentation is available in /docs.