chilimatic / cache-component
cache component within the chilimatic framework
Installs: 97
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/chilimatic/cache-component
Requires
- php: >=7.1
- chilimatic/interfaces-component: 2.*
Requires (Dev)
- phpunit/phpunit: 6.5.*
This package is auto-updated.
Last update: 2025-09-09 16:22:28 UTC
README
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 :)