Registry implements SingletonInterface
A class to store and retrieve entries in a registry database table.
This is a simple, persistent key-value-pair store.
The intention is to have a place where we can store things (mainly settings) that should live for more than one request, longer than a session, and that shouldn't expire like it would with a cache. You can actually think of it being like the Windows Registry in some ways.
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $entries : array<string|int, mixed>
- $loadedNamespaces : array<string|int, mixed>
Methods
- get() : mixed
- Returns a persistent entry.
- remove() : mixed
- Unset a persistent entry.
- removeAllByNamespace() : mixed
- Unset all persistent entries of given namespace.
- set() : mixed
- Sets a persistent entry.
- isNamespaceLoaded() : bool
- check if the given namespace is loaded
- loadEntriesByNamespace() : mixed
- Loads all entries of given namespace into the internal $entries cache.
- validateNamespace() : mixed
- Check namespace key It must be at least two characters long. The word 'core' is reserved for TYPO3 core usage.
Properties
$entries
protected
array<string|int, mixed>
$entries
= []
$loadedNamespaces
protected
array<string|int, mixed>
$loadedNamespaces
= []
Methods
get()
Returns a persistent entry.
public
get(string $namespace, string $key[, mixed $defaultValue = null ]) : mixed
Parameters
- $namespace : string
-
Extension key of extension
- $key : string
-
Key of the entry to return.
- $defaultValue : mixed = null
-
Optional default value to use if this entry has never been set. Defaults to NULL.
Tags
Return values
mixed —Value of the entry.
remove()
Unset a persistent entry.
public
remove(string $namespace, string $key) : mixed
Parameters
- $namespace : string
-
Extension key of extension
- $key : string
-
The key of the entry to unset.
Tags
removeAllByNamespace()
Unset all persistent entries of given namespace.
public
removeAllByNamespace(string $namespace) : mixed
Parameters
- $namespace : string
-
Extension key of extension
Tags
set()
Sets a persistent entry.
public
set(string $namespace, string $key, mixed $value) : mixed
This is the main method that can be used to store a key-value-pair.
Do not store binary data into the registry, it's not build to do that, instead use the proper way to store binary data: The filesystem.
Parameters
- $namespace : string
-
Extension key of extension
- $key : string
-
The key of the entry to set.
- $value : mixed
-
The value to set. This can be any PHP data type; This class takes care of serialization
Tags
isNamespaceLoaded()
check if the given namespace is loaded
protected
isNamespaceLoaded(string $namespace) : bool
Parameters
- $namespace : string
-
Extension key of extension
Return values
bool —True if namespace was loaded already
loadEntriesByNamespace()
Loads all entries of given namespace into the internal $entries cache.
protected
loadEntriesByNamespace(string $namespace) : mixed
Parameters
- $namespace : string
-
Extension key of extension
Tags
validateNamespace()
Check namespace key It must be at least two characters long. The word 'core' is reserved for TYPO3 core usage.
protected
validateNamespace(string $namespace) : mixed
Parameters
- $namespace : string
-
Namespace