Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Generic cache interface for FileSystem cache, Memcached, ApcCache, ... etc
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/CacheKit
tests
README.md
build.xml
composer.json
package.ini
package.xml
phpdox.xml
phprelease.ini
phpunit-ci.xml
phpunit.xml

README.md

CacheKit

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 ) );
Something went wrong with that request. Please try again.