emaphp / simplecache
A simple cache library for PHP
1.1
2015-02-23 19:07 UTC
This package is not auto-updated.
Last update: 2024-11-05 02:38:20 UTC
README
A simple cache library for PHP
####Changelog
2014-02-23
- Moved to PSR-4.
- Added class 'TestProvider'. This class stores values in an internal hash for testing purposes.
####Description
Simplecache is a small PHP library that provides some useful caching classes compatible with APC and Memcache.
####Dependencies
None
####Installation
{ "require": { "emaphp/simplecache": "1.1.*" } }
####Usage
include 'vendor/autoload.php'; use SimpleCache\APCProvider; //create provider $provider = new APCProvider(); //store value $provider->store("SimpleCache example", "message", 60); //obtain value $message = $provider->fetch('message'); //delete value from cache $provider->delete('message'); //check for presence $provider->exists('message'); // returns false
**Memcache**
There are 2 classes available for memcache servers: MemcacheProvider and MemcachedProvider. Both must specify the server location during initialization.
//memcache use SimpleCache\MemcacheProvider; $provider = new MemcacheProvider('localhost', 11211); //memcached use SimpleCache\MemcachedProvider; $provider = new MemcachedProvider(); $provider->addServer('localhost', 11211);
####License
Licensed under the Apache License, Version 2.0.