An open API service indexing awesome lists of open source software.

https://github.com/shuber/cache

A simple php caching library with swappable backends
https://github.com/shuber/cache

Last synced: 21 days ago
JSON representation

A simple php caching library with swappable backends

Awesome Lists containing this project

README

          

# Cache

A simple php caching library with swappable backends

## Usage

$cache = new Cache('Filesystem', '/path/to/your/cache');

$cache->write('users', array('bob', 'joe', 'tim'));
print_r($cache->read('users'));
$cache->delete('users');

// If a fresh cache exists then it returns it, otherwise it executes the block (passing the current cache's modified time if there is one) and caches the result
print_r($cache->fetch('admins', function($modified_at) {
return Admin::all();
}));