【发布时间】:2018-01-28 18:50:44
【问题描述】:
我正在尝试在我的一个服务类中实现一个 SimpleCache 具体实例以也允许缓存,但是我在连接依赖项时遇到了一些问题。
config/services.yml
services:
Psr\SimpleCache\CacheInterface: '@Symfony\Component\Cache\Simple\FilesystemCache'
src/Services/Shouter/Sources/Twitter.php
<?php
namespace App\Services\Shouter\Sources;
use Psr\SimpleCache\CacheInterface;
class Twitter
{
/**
* Cache instance
* @var Psr\SimpleCache\CacheInterface
*/
protected $cache;
public function __construct(CacheInterface $cache)
{
$this->cache = $cache;
}
}
这是我得到的错误:
你请求了一个不存在的服务“Symfony\Component\Cache\Simple\FilesystemCache”。
【问题讨论】: