Drupal 8  8.0.2
State Class Reference
Inheritance diagram for State:

Public Member Functions

 __construct (KeyValueFactoryInterface $key_value_factory)
 
 get ($key, $default=NULL)
 
 getMultiple (array $keys)
 
 set ($key, $value)
 
 setMultiple (array $data)
 
 delete ($key)
 
 deleteMultiple (array $keys)
 
 resetCache ()
 

Protected Attributes

 $keyValueStore
 
 $cache = array()
 

Detailed Description

Provides the state system using a key value store.

Constructor & Destructor Documentation

__construct ( KeyValueFactoryInterface  $key_value_factory)

Constructs a State object.

Parameters
\Drupal\Core\KeyValueStore\KeyValueFactoryInterface$key_value_factoryThe key value store to use.

References KeyValueFactoryInterface\get().

Here is the call graph for this function:

Member Function Documentation

delete (   $key)

{Deletes an item.

Parameters
string$keyThe item name to delete.
}

Implements StateInterface.

References State\deleteMultiple().

Here is the call graph for this function:

deleteMultiple ( array  $keys)

{Deletes multiple items.

Parameters
array$keysA list of item names to delete.
}

Implements StateInterface.

References Drupal\cache().

Referenced by State\delete().

Here is the call graph for this function:

Here is the caller graph for this function:

get (   $key,
  $default = NULL 
)

{Returns the stored value for a given key.

Parameters
string$keyThe key of the data to retrieve.
mixed$defaultThe default value to use if the key is not found.
Returns
mixed The stored value, or NULL if no value exists.
}

Implements StateInterface.

References State\getMultiple().

Here is the call graph for this function:

getMultiple ( array  $keys)

{Returns the stored key/value pairs for a given set of keys.

Parameters
array$keysA list of keys to retrieve.
Returns
array An associative array of items successfully returned, indexed by key.
}

Implements StateInterface.

References Drupal\cache().

Referenced by State\get().

Here is the call graph for this function:

Here is the caller graph for this function:

resetCache ( )

{Resets the static cache.This is mainly used in testing environments.}

Implements StateInterface.

References Drupal\cache().

Here is the call graph for this function:

set (   $key,
  $value 
)

{Saves a value for a given key.

Parameters
string$keyThe key of the data to store.
mixed$valueThe data to store.
}

Implements StateInterface.

References Drupal\cache().

Here is the call graph for this function:

setMultiple ( array  $data)

{Saves key/value pairs.

Parameters
array$dataAn associative array of key/value pairs.
}

Implements StateInterface.

References Drupal\cache().

Here is the call graph for this function:


The documentation for this class was generated from the following file: