library cache
Allows caching using different drivers
anekdotes/cache
Allows caching using different drivers
- Thursday, November 17, 2016
- by anekdotes
- Repository
- 1 Watchers
- 0 Stars
- 162 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 3 Versions
- 2 % Grown
Anekdotes Cache
, (*1)
Allows caching using different drivers, (*2)
Installation
Install via composer into your project:, (*3)
composer require anekdotes/cache
Usage
Declare your Cache object depending on your Driver. After construction, all Cache objects can be manipulated the same way., (*4)
use Anekdotes\Cache\FileCache;
$path = 'tmp/cache/'; //The slash at the end is IMPORTANT. MAKE SURE YOU HAVE IT!
$cache = new FileCache($path);
$key = 'Toaster';
$value = 'Test';
$minutes = 5;
$cache->set($key, $value, $minutes);
$cache->get('Toaster'); //Returns 'Test' as long as this call is made in a 5 minute time-frame past the previous set call.
$cache->time('Toaster'); //Return the datetime object of when this key has been set
$cache->forget('Toaster');
$cache->has('Toaster'); //Returns false.
Notes
-
The ArrayCache driver does not currently analyze expiration time. This means all array cached objects last forever., (*5)
-
The FileCache driver does not implement the increment and decrement functions. Both functions throw LogicException under this driver., (*6)
-
Setting a cache's expiration to zero will make it never expire. Using ```$cache->forever()````does the same thing., (*7)
-
You can use $cache->flush()
to remove all data in the cache., (*8)
dev-master
9999999-dev
Allows caching using different drivers
Sources
Download
MIT
The Requires
The Development Requires
file
cache
array
storage
1.0.1
1.0.1.0
Allows caching using different drivers
Sources
Download
MIT
The Requires
The Development Requires
file
cache
array
storage
1.0.0
1.0.0.0
Allows caching using different drivers
Sources
Download
MIT
The Requires
The Development Requires
file
cache
array
storage