I you wan’t to use Symfony app cache (with redis for example), this is a simple how-to:
# config_prod.yml
framework:
cache:
app: cache.adapter.redis
default_redis_provider: "redis://%redis_host%"
Then use it as a service with `cache.app` name.
When injected in your service, you will retrieve an Symfony\Component\Cache\Adapter\TraceableAdapter. But when available, best practise is to typint it as the PSR’s interface.
public function __construct(
Psr\Cache\CacheItemPoolInterface $cacheItemPool
)
Then all the methods defined by the PSR are available.
http://www.php-fig.org/psr/psr-16/#interfaces