Skip to content
Snippets Groups Projects
Commit 2bc10cd5 authored by Steven Jones's avatar Steven Jones
Browse files

git commit -m 'Issue #3133414 by Steven Jones: Remove unused service from the cache factory'

parent ac03e9c3
No related branches found
No related tags found
No related merge requests found
......@@ -2,14 +2,12 @@
namespace Drupal\varnish\Cache;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
class VarnishBackend implements CacheBackendInterface{
protected $bin;
protected $pathAliasManager;
/**
* Constructs a VarnishBackend object.
......@@ -17,9 +15,8 @@ class VarnishBackend implements CacheBackendInterface{
* @param string $bin
* The cache bin for which the object is created.
*/
function __construct($bin, $pathAliasManager) {
function __construct($bin) {
$this->bin = $bin;
$this->pathAliasManager = $pathAliasManager;
}
......
......@@ -2,24 +2,25 @@
namespace Drupal\varnish\Cache;
use Drupal\Core\Cache\CacheFactoryInterface;
use \Drupal\path_alias\AliasManager;
class VarnishBackendFactory implements CacheFactoryInterface{
protected $pathAliasManager;
function __construct(AliasManager $pathAliasManager) {
$this->pathAliasManager = $pathAliasManager;
}
/**
* Instantiated varnish cache bins.
*
* @var \Drupal\varnish\Cache\VarnishBackend[]
*/
protected $bins = [];
/**
* {@inheritdoc}
*/
public function get($bin) {
return new VarnishBackend($bin, $this->pathAliasManager);
if (!isset($this->bins[$bin])) {
$this->bins[$bin] = new VarnishBackend($bin);
}
return $this->bins[$bin];
}
}
services:
cache.backend.varnish:
class: Drupal\varnish\Cache\VarnishBackendFactory
arguments: ['@path_alias.manager', '@settings']
cache.varnish:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment