set() public method

The key-value store accepts any serializable value. If a value is not serializable, a {@link SerializationFailedException} is thrown. Additionally, implementations may put further restrictions on their accepted values. If an unsupported value is passed, an {@link UnsupportedValueException} is thrown. Check the documentation of the implementation to learn more about its supported values. Any integer or string value is accepted as key. If any other type is passed for the key, an {@link InvalidKeyException} is thrown. You should make sure that you only pass valid keys to the store. If the backend of the store cannot be written, a {@link WriteException} is thrown. You should always handle this exception in your code: php try { $store->set($key, $value); } catch (WriteException $e) { write failed }
public set ( integer | string $key, mixed $value )
$key integer | string The key to set.
$value mixed The value to set for the key.
 private function syncBindingsForKey($key)
 {
     if (count($this->bindingsByKey[$key]) > 0) {
         $this->store->set('b:' . $key, $this->bindingsByKey[$key]);
     } else {
         unset($this->bindingsByKey[$key]);
         $this->store->remove('b:' . $key);
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function removeBindingsWithTypeNameThatMatch($typeName, Expression $expr)
 {
     if (!isset($this->keysByTypeName[$typeName])) {
         return;
     }
     $key = $this->keysByTypeName[$typeName];
     if (!isset($this->bindingsByKey[$key])) {
         $this->loadBindingsForKey($key);
     }
     foreach ($this->bindingsByKey[$key] as $i => $binding) {
         if ($expr->evaluate($binding)) {
             unset($this->bindingsByKey[$key][$i]);
             unset($this->keysByUuid[$binding->getUuid()->toString()]);
         }
     }
     // Reindex array
     $this->bindingsByKey[$key] = array_values($this->bindingsByKey[$key]);
     $this->store->set('b:' . $key, $this->bindingsByKey[$key]);
     $this->store->set('::keysByUuid', $this->keysByUuid);
 }
 /**
  * {@inheritdoc}
  */
 public function append(PuliResource $resource)
 {
     $versions = $this->store->get($resource->getPath(), array());
     $versions[] = $resource;
     $this->store->set($resource->getPath(), $versions);
 }
 /**
  * {@inheritdoc}
  */
 public function set($key, $value)
 {
     $this->store->set($key, $value);
 }
 /**
  * {@inheritdoc}
  */
 protected function removeBindingsByQueryAndType($query, $typeName, array $parameterValues = null)
 {
     parent::removeBindingsByQueryAndType($query, $typeName, $parameterValues);
     $this->store->set('//typeIndex', $this->typeIndex);
     $this->store->set('//queryIndex', $this->queryIndex);
 }