Issue #1804024 by msonnabaum: Added Remove constructor from k/v interface.
parent
890865c7a4
commit
a834496e18
|
@ -20,14 +20,12 @@ class DatabaseStorage extends StorageBase {
|
|||
*
|
||||
* @param string $collection
|
||||
* The name of the collection holding key and value pairs.
|
||||
* @param array $options
|
||||
* An associative array of options for the key/value storage collection.
|
||||
* Keys used:
|
||||
* - table. The name of the SQL table to use, defaults to key_value.
|
||||
* @param string $table
|
||||
* The name of the SQL table to use, defaults to key_value.
|
||||
*/
|
||||
public function __construct($collection, array $options = array()) {
|
||||
parent::__construct($collection, $options);
|
||||
$this->table = isset($options['table']) ? $options['table'] : 'key_value';
|
||||
public function __construct($collection, $table = 'key_value') {
|
||||
parent::__construct($collection);
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,16 +12,6 @@ namespace Drupal\Core\KeyValueStore;
|
|||
*/
|
||||
interface KeyValueStoreInterface {
|
||||
|
||||
/**
|
||||
* Constructs a new key/value collection.
|
||||
*
|
||||
* @param string $collection
|
||||
* The name of the collection holding key and value pairs.
|
||||
* @param array $options
|
||||
* An associative array of options for the key/value storage collection.
|
||||
*/
|
||||
public function __construct($collection, array $options = array());
|
||||
|
||||
/**
|
||||
* Returns the name of this collection.
|
||||
*
|
||||
|
|
|
@ -9,11 +9,8 @@ namespace Drupal\Core\KeyValueStore;
|
|||
|
||||
/**
|
||||
* Defines a default key/value store implementation.
|
||||
*
|
||||
* For performance reasons, this implementation is not based on
|
||||
* Drupal\Core\KeyValueStore\StorageBase.
|
||||
*/
|
||||
class MemoryStorage implements KeyValueStoreInterface {
|
||||
class MemoryStorage extends StorageBase {
|
||||
|
||||
/**
|
||||
* The actual storage of key-value pairs.
|
||||
|
@ -22,20 +19,6 @@ class MemoryStorage implements KeyValueStoreInterface {
|
|||
*/
|
||||
protected $data = array();
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::__construct().
|
||||
*/
|
||||
public function __construct($collection, array $options = array()) {
|
||||
$this->collection = $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getCollectionName().
|
||||
*/
|
||||
public function getCollectionName() {
|
||||
return $this->collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::get().
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ abstract class StorageBase implements KeyValueStoreInterface {
|
|||
/**
|
||||
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::__construct().
|
||||
*/
|
||||
public function __construct($collection, array $options = array()) {
|
||||
public function __construct($collection) {
|
||||
$this->collection = $collection;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue