Skip to content

battis/simplecache

Repository files navigation

SimpleCache

Latest Version Scrutinizer Code Quality Code Coverage Build Status

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.

About

Manage a simple cache backed by a MySQL database

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages