Ejemplo n.º 1
0
 public function __construct(array $settings = [])
 {
     parent::__construct($settings);
     $this['log'] = function ($container) {
         return new \App\Service\Logger();
     };
     $this['cacheDriver'] = function ($container) {
         $options = ['ttl' => 3600, 'namespace' => md5(__FILE__)];
         $driver = new Stash\Driver\Apc();
         $driver->setOptions($options);
         return $driver;
     };
     $this['cachePool'] = function ($container) {
         return new Stash\Pool($container['cacheDriver']);
     };
 }
Ejemplo n.º 2
0
<?php

$c = new \Slim\Container(['settings' => ['displayErrorDetails' => true]]);
$c['log'] = function ($container) {
    return new \App\Service\Logger();
};
$c['cacheDriver'] = function ($container) {
    $options = array('ttl' => 3600, 'namespace' => md5(__FILE__));
    $driver = new Stash\Driver\Apc();
    $driver->setOptions($options);
    return $driver;
};
$c['cachePool'] = function ($container) {
    return new Stash\Pool($container['cacheDriver']);
};