SystemData#

NAME#

Kernel::System::SystemData - key/value store for system data

DESCRIPTION#

Provides key/value store for system data

PUBLIC INTERFACE#

new()#

Don’t use the constructor directly, use the ObjectManager instead:

my $SystemDataObject = $Kernel::OM->Get('Kernel::System::SystemData');

SystemDataAdd()#

add a new SystemData value.

Result is true if adding was OK, and false if it failed, for instance because the key already existed.

If your keys contain ‘::’ this will be used as a separator. This allows you to later for instance fetch all keys that start with ‘SystemRegistration::’ in one go, using SystemDataGetGroup().

my $Result = $SystemDataObject->SystemDataAdd(
    Key    => 'SomeKey',
    Value  => 'Some Value',
    UserID => 123,
);

my $Result = $SystemDataObject->SystemDataAdd(
    Key    => 'SystemRegistration::Version',
    Value  => 'Some Value',
    UserID => 123,
);

SystemDataGet()#

get system data for key

my $SystemData = $SystemDataObject->SystemDataGet(
    Key => 'Znuny Version',
);

returns value as a simple scalar, or undef if the key does not exist. keys set to NULL return an empty string.

SystemDataGroupGet()#

returns a hash of all keys starting with the Group. For instance the code below would return values for ‘SystemRegistration::UniqueID’, ‘SystemRegistration::UpdateID’, and so on.

my %SystemData = $SystemDataObject->SystemDataGroupGet(
    Group => 'SystemRegistration',
);

returns

%SystemData = (
    UniqueID => 'CDC782BE-E483-11E2-83DA-9FFD99890B3C',
    UpdateID => 'D8F55850-E483-11E2-BD60-9FFD99890B3C'
    # ...
);

SystemDataUpdate()#

update system data

Returns true if update was successful or false if otherwise - for instance if key did not exist.

my $Result = $SystemDataObject->SystemDataUpdate(
    Key    => 'Znuny Version',
    Value  => 'Some New Value',
    UserID => 123,
);

SystemDataDelete()#

update system data

Returns true if delete was successful or false if otherwise - for instance if key did not exist.

$SystemDataObject->SystemDataDelete(
    Key    => 'Znuny Version',
    UserID => 123,
);

_SystemDataCacheKeyDelete()#

This will delete the cache for the given key and for all groups, if needed.

For a key such as ‘Foo::Bar::Baz’, it will delete the cache for ‘Foo::Bar::Baz’ as well as for the groups ‘Foo::Bar’ and ‘Foo’.

$Success = $SystemDataObject->_SystemDataCacheKeyDelete(
    Key => 'SystemRegistration::Version::DB',
);