Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 592 Bytes

cache.md

File metadata and controls

19 lines (14 loc) · 592 Bytes

Cache

Berlioz integrate a cache service but subtract management to another lib. We recommend to use phpFastCache. The cache service MUST implements \Psr\SimpleCache\CacheInterface interface.

Example

// Configuration
$config = new \Berlioz\Core\Config(__ROOT_DIR__, '/config/config.json');

// Cache manager
$cacheManager = new phpFastCache\Helper\Psr16Adapter('Files', ['path' => $config->getDirectory(\Berlioz\Core\ConfigInterface::DIR_VAR_CACHE)]);

// Application
$app = new \Berlioz\Core\App($config);
$app->getServices()->set('cache', $cacheManager);