Skip to content

chilimatic/cache-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cache-component

Build Status

Currently there are 3 adapters:

Memcached, Apcu and Memory

It also comes with a singelton wrapper but you don't have to use it.

$cache = Cache::getInstance(['type' => chilimatic\lib\Cache\Engine\Adapter\Memory::class]);

If you want to use a Factory

$cache = CacheFactory::make(chilimatic\lib\Cache\Engine\Adapter\Memory::class);

And ofc you can access them directly

$cache = new chilimatic\lib\Cache\Engine\Adapter\Memory();

you can pass in arrays or stdClass it will transform it to an array anyway (nested too)

$cache = new chilimatic\lib\Cache\Engine\Adapter\Memcached([
    'server_list' => [[
        'host' => '127.0.0.1',
        'port' => 11211,
        'weight' => 1
    ]],
    'options' => [ // the options are per instance not per connection!
        Memcached::OPT_HASH => Memcached::HASH_MURMUR
    ]
]);

more about the possible options http://php.net/manual/en/memcached.constants.php

$cache = new chilimatic\lib\Cache\Engine\Adapter\APCU();

one of the benefits of this library is that it actually allows you to see what theoretically stored within the caches

$cache = chilimatic\lib\Cache\Engine\Adapter\Memory();

var_dump($cache->listEntries());

it has 1 dependency the chilimatic interfaces.

if you want to know how things work I recommend looking at the tests :)

About

Cache Component chilimatic framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages