За кэш отвечает класс Doctrine\Common\Cache\CacheProvider и его потомки.
Там можно что угодно использовать в качестве хранилища.
return [
IConnection::class => Di\Singleton(Connection::class),
ICache::class => Di\Singleton(Cache::class),
IAuthorRepository::class => Di\Transient(UserRepository::class, [
Di\Link(IConnection::class), Di\Link(ICache::class)
]),
];
class Container extends Framework\Container
{
protected $Framework_IConnection;
protected $Framework_ICache;
public function getFramework_IConnection() {
return $this->Framework_IConnection ?: $this->Framework_IConnection = new Espresso\Connection();
}
public function getFramework_ICache() {
return $this->Framework_ICache ?: $this->Framework_ICache = new Espresso\Cache();
}
public function getIAuthorRepository() {
return new UserRepository($this->getFramework_IConnection(), $this->getFramework_ICache());
}
}
class Container
{
public function resolve($alias)
{
if (method_exists($this, $method = 'get'. str_replace('\\', '_', $alias))) {
return $this->{$method}();
} else {
return $this->dinamicLookup($alias);
}
}
}
IBaz::class => singleton(Baz::class)
->withConstructorPatameter('something')
->withMethodCall('setSomething', ['something']);
\DI\factory(function ($c) {
$config = $c->get(Config::class)->load('routing.yml')
return new Router($dispatcher, $config);
});