corneltek / cachekit
General cache interface
Installs: 6 843
Dependents: 1
Suggesters: 0
Security: 0
Stars: 9
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: >=5.3.0
- corneltek/serializerkit: ~1
Requires (Dev)
- corneltek/phpunit-testmore: dev-master
This package is auto-updated.
Last update: 2024-10-29 04:03:55 UTC
README
Generic cache interface for PHP.
CacheKit Interface
$c = new CacheKit; $memory = $c->createBackend( 'MemoryCache' ); $c->set( 'foo' , 123 ); $memory->set( 'foo' , '123' ); $val = $memory->get('foo');
ApcCache Interface
$cache = new CacheKit\ApcCache(array( 'namespace' => 'app_', 'default_expiry' => 3600, )); $cache->set($name,$val); $val = $cache->get($name); $cache->remove($name);
FileSystemCache
$serializer = new SerializerKit\Serializer('json');
$cache = new CacheKit\FileSystemCache(array(
'expiry' => 30,
'cache_dir' => 'cache',
'serializer' => $serializer,
));
$cache->clear();
$url = 'foo_bar';
$html = 'test content';
$cache->set( $url , $html );
$cache->remove( $url );
ok( null === $cache->get( $url ) );
$cache->clear();
ok( null === $cache->get( $url ) );