CSMemoryDatabaseInstance
in package
Defines the instance class for the memory database interface.
The class creates an instance API object, which redirects the calls to the corresponding service depending on the given configuration.
Tags
Table of Contents
- __construct() : mixed
- Defines the constructor of the memory database instance with the required configuration API object.
- deleteItem() : bool
- Deletes a memory database item for a given key.
- getConfiguration() : CSMemoryDatabaseConfiguration
- Returns the given & stored configuration of the memory database instance.
- getItem() : CSMemoryDatabaseItem
- Returns the memory database item for the given key.
- getMode() : int
- Returns the current mode of the instance.
- getServiceInfo() : CSMemoryDatabaseServiceInfo
- getServiceType() : int
- Returns the stored service type of the memory database instance.
- getSessionHandler() : CSMemoryDatabaseSessionHandler|null
- Returns a session handler API object if the service provides a separate session handling.
- invalidate() : bool
- Invalidate memory database items for specific given tag names.
- isConnected() : bool
- Checks if the service is connected.
- isEnabled() : bool
- Checks if the instance is enabled.
- isMode() : bool
- Checks if the given mode is active in the memory database instance.
- prepareErrorMessage() : void
- Provides the possibility to modify / prepare error message specific for a service type.
- setItem() : bool
- Sets & stores a given memory database item to the service storage.
Methods
__construct()
Defines the constructor of the memory database instance with the required configuration API object.
public
final __construct(CSMemoryDatabaseConfiguration $oConfiguration) : mixed
Parameters
- $oConfiguration : CSMemoryDatabaseConfiguration
Tags
Return values
mixed —deleteItem()
Deletes a memory database item for a given key.
public
final deleteItem(string $sKey) : bool
If the item exists and could be deleted, the method will return true, otherwise false.
Parameters
- $sKey : string
-
The target key of the item.
Tags
Return values
bool —getConfiguration()
Returns the given & stored configuration of the memory database instance.
public
final getConfiguration() : CSMemoryDatabaseConfiguration
Tags
Return values
CSMemoryDatabaseConfiguration —getItem()
Returns the memory database item for the given key.
public
final getItem(string $sKey) : CSMemoryDatabaseItem
If the key does not exist, an empty memory database item will be returned.
Parameters
- $sKey : string
-
The target key of the item.
Tags
Return values
CSMemoryDatabaseItem —getMode()
Returns the current mode of the instance.
public
final getMode() : int
Please use the constants "CSMemoryDatabaseConst::MODE_" as return values.
Tags
Return values
int —getServiceInfo()
public
final getServiceInfo() : CSMemoryDatabaseServiceInfo
Tags
Return values
CSMemoryDatabaseServiceInfo —getServiceType()
Returns the stored service type of the memory database instance.
public
final getServiceType() : int
Tags
Return values
int —getSessionHandler()
Returns a session handler API object if the service provides a separate session handling.
public
final getSessionHandler() : CSMemoryDatabaseSessionHandler|null
If no session handling is supported, the method will return "null":
Tags
Return values
CSMemoryDatabaseSessionHandler|null —invalidate()
Invalidate memory database items for specific given tag names.
public
final invalidate([array<string|int, mixed> $aTags = [] ]) : bool
It will delete all items, which have defined the given tags.
Parameters
- $aTags : array<string|int, mixed> = []
-
An array with tag names that should be deleted.
Tags
Return values
bool —isConnected()
Checks if the service is connected.
public
final isConnected() : bool
Tags
Return values
bool —isEnabled()
Checks if the instance is enabled.
public
final isEnabled() : bool
Tags
Return values
bool —isMode()
Checks if the given mode is active in the memory database instance.
public
final isMode(int $iMode) : bool
Parameters
- $iMode : int
-
The mode, which should be checked. Please use the constants "CSMemoryDatabaseConst::MODE_"
Tags
Return values
bool —prepareErrorMessage()
Provides the possibility to modify / prepare error message specific for a service type.
public
final prepareErrorMessage(string &$sMessage, int $iErrorType, bool &$bShowTrace) : void
Parameters
- $sMessage : string
-
The original error message.
- $iErrorType : int
-
The error type.
- $bShowTrace : bool
-
Whether the trace should be shown for the corresponding error message.
Tags
Return values
void —setItem()
Sets & stores a given memory database item to the service storage.
public
final setItem(CSMemoryDatabaseItem $oItem) : bool
Parameters
- $oItem : CSMemoryDatabaseItem
-
The target item, which should be stored to the service storage.
