PHP-Cache 1.0
PHP-Cache uses a file system as a fallback and for the 'persistent' data.
Requirements:
PHP 5.3.0 or Higher
Abstract base library to cache any data to any backend. Uses file system as a fall back and for 'persistent' data.
### Specs
* Run the "run" script in the Specs directory
### Example
use Cache\Cache;
$c = new Cache('/path/to/file/cache', array(
'prefix' => 'MyAppPrefix'
));
$c->store('anyKey', $anyData);
$c->retrieve('anyKey'); // returns $anyData !
$c->erase('anyKey');
### Actual Use-Case Example
$data = $c->retrieve('data');
if (!$data){
$data = doSomeExpensiveCalculation();
$c->store('data', $data);
}
$data; // Has expensive data!
### Or, with PHP 5.3 Style
$data = $c->retrieve('myKey', function($c, $key){
return $c->store($key, doSomeExpensiveCalculation());
});
The above function is only being executed if there is no associated data to 'myKey'. If a function gets passed like this, the 'retrieve' method returns whatever the passed in function returns. As a convenience the 'store' method returns the input (= second argument).
### Here There Be Tags
$c->store('a', 'banana banana banana', array(
'tags' => 'bananas'
));
$c->store('b', 'apple apple banana', array(
'tags' => array('apples', 'bananas')
));
$c->eraseByTag('bananas');
$c->retrieve('a'); // null
More popular Cache
- Class Cache 1.0 (7 years, 7 months 23 days ago)
- Files folder image SharedMemory 1.0 (2 years, 4 months 29 days ago)
- sqlCache API Library 1.0 (2 years, 4 months 29 days ago)
- File Cache 1.0 (4 years, 2 months 13 days ago)
- PHP-Cache 1.0 (1 year, 4 months 25 days ago)
Listing Files

Cache.php- 3.8 KB
- 08/05/2010 10:01:42

run- 88 Bytes
- 08/05/2010 10:01:42

RunAll.php- 1.3 KB
- 08/05/2010 10:01:42

Cache.php- 4.4 KB
- 08/05/2010 10:01:42

ICacheBackend.php- 310 Bytes
- 08/05/2010 10:01:42

File.php- 921 Bytes
- 08/05/2010 10:01:42

APC.php- 587 Bytes
- 08/05/2010 10:01:42

Memcache.php- 1.2 KB
- 08/05/2010 10:01:42

README.md- 1.3 KB
- 08/05/2010 10:01:42

LICENSE- 1.1 KB
- 08/05/2010 10:01:42

namespace- 5 Bytes
- 08/05/2010 10:01:42
- FREE MySQL Cloud Database Super Simple, Zero-Management MySQL Cloud DB. Use It FREE!
- Pinterest clone Start your own pin board social network today. Get Pintastic and start your own pinterest clone network.
- MYRE Real Estate Software Professional Real Estate solutions by MYREPHP PROGRAMMING!
