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
- Host: GitHub
- URL: https://github.com/shuber/cache
- Owner: shuber
- Created: 2011-04-08T21:43:16.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2012-12-06T23:31:18.000Z (over 13 years ago)
- Last Synced: 2025-02-25T21:42:25.047Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 102 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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();
}));