EscapeWork\Cache (Beta)
Em construção., (*1)
Exemplos
use EscapeWork\Cache\Facade as Cache;
# setting
Cache::set('key', 'value', 'namespace'); # namespace Ć© opcional
# getting
# if the value don't exists in cache, the closure is called
Cache::get('key', function() {
return 'your function to get data';
}, 'namespace');
# deleting
Cache::delete('key');
# flush namespace
Cache::flushNamespace('namespace');
# flush all cache
Cache::flush();
Tipos de cache disponĆveis
- Memcached
- APC
- File
- Array (Para testes unitƔrios)
Configuração
use EscapeWork\Cache\Facade as Cache;
Cache::driver(array(
'driver' => 'memcached',
'memcached' => array(
array('host' => 'your-host', 'port' => 11211) # server settings
),
));
Cache::driver(array(
'driver' => 'file',
'path' => '/path/to/your/cache/dir/',
));
Instalação
A instalação estĆ” disponĆvel via Composer. Autoload compĆ”tivel com a PSR-0., (*2)
{
"require": {
"escapework/cache": "0.1.*"
}
}