Issue #2143011 by damiankloip: Add a CacheFactoryInterface.

8.0.x
Nathaniel Catchpole 2014-01-07 11:33:55 +00:00
parent 01b27e2598
commit a4f85eb408
4 changed files with 30 additions and 10 deletions

View File

@ -14,7 +14,7 @@ use Drupal\Component\Utility\Settings;
use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
class CacheFactory extends ContainerAware { class CacheFactory extends ContainerAware implements CacheFactoryInterface {
/** /**
* The settings array. * The settings array.

View File

@ -0,0 +1,26 @@
<?php
/**
* @file
* Contains \Drupal\Core\Cache\CacheFactoryInterface.
*/
namespace Drupal\Core\Cache;
/**
* An interface defining cache factory classes.
*/
interface CacheFactoryInterface {
/**
* Gets a cache backend class for a given cache bin.
*
* @param string $bin
* The cache bin for which a cache backend object should be returned.
*
* @return \Drupal\Core\Cache\CacheBackendInterface
* The cache backend object associated with the specified bin.
*/
public function get($bin);
}

View File

@ -9,7 +9,7 @@ namespace Drupal\Core\Cache;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
class DatabaseBackendFactory { class DatabaseBackendFactory implements CacheFactoryInterface {
/** /**
* The database connection. * The database connection.

View File

@ -7,16 +7,10 @@
namespace Drupal\Core\Cache; namespace Drupal\Core\Cache;
class MemoryBackendFactory { class MemoryBackendFactory implements CacheFactoryInterface {
/** /**
* Gets MemoryBackend for the specified cache bin. * {@inheritdoc}
*
* @param $bin
* The cache bin for which the object is created.
*
* @return \Drupal\Core\Cache\MemoryBackend
* The cache backend object for the specified cache bin.
*/ */
function get($bin) { function get($bin) {
return new MemoryBackend($bin); return new MemoryBackend($bin);