Issue #2664322 by benjifisher, dawehner, daffie, almaudoh, mradcliffe, catch,...
Issue #2664322 by benjifisher, dawehner, daffie, almaudoh, mradcliffe, catch, quietone, alexpott, larowlan: key_value table is only used by a core service but it depends on system install
@@ -61,11 +61,17 @@ public function __construct($collection, SerializationInterface $serializer, Con
* {@inheritdoc}
*/
publicfunctionhas($key){
try{
return(bool)$this->connection->query('SELECT 1 FROM {'.$this->connection->escapeTable($this->table).'} WHERE [collection] = :collection AND [name] = :key',[
':collection'=>$this->collection,
':key'=>$key,
])->fetchField();
}
catch(\Exception$e){
$this->catchException($e);
returnFALSE;
}
}
/**
* {@inheritdoc}
@@ -92,9 +98,15 @@ public function getMultiple(array $keys) {
* {@inheritdoc}
*/
publicfunctiongetAll(){
try{
$result=$this->connection->query('SELECT [name], [value] FROM {'.$this->connection->escapeTable($this->table).'} WHERE [collection] = :collection',[':collection'=>$this->collection]);
@@ -33,17 +33,24 @@ public function __construct($collection, SerializationInterface $serializer, Con
* {@inheritdoc}
*/
publicfunctionhas($key){
try{
return(bool)$this->connection->query('SELECT 1 FROM {'.$this->connection->escapeTable($this->table).'} WHERE [collection] = :collection AND [name] = :key AND [expire] > :now',[
':collection'=>$this->collection,
':key'=>$key,
':now'=>REQUEST_TIME,
])->fetchField();
}
catch(\Exception$e){
$this->catchException($e);
returnFALSE;
}
}
/**
* {@inheritdoc}
*/
publicfunctiongetMultiple(array$keys){
try{
$values=$this->connection->query(
'SELECT [name], [value] FROM {'.$this->connection->escapeTable($this->table).'} WHERE [expire] > :now AND [name] IN ( :keys[] ) AND [collection] = :collection',
[
@@ -53,11 +60,21 @@ public function getMultiple(array $keys) {