Writing own storage

From Sunhill Framework Documentation
Revision as of 15:57, 9 October 2024 by Klaus (talk | contribs) (+ Standard storages)

When writing your own storage first check if you can use on of these storages as a base:

If you can't use one of the above you have to overwrite the following abstract methods

Abstract methods

doGetValue(string $name)

Performs the retrievement of the value.

doGetIndexedValue(string $name, mixed $index): mixed

Gets from the array element $name the entry identified by $index Note: This routine does not check, if the element is an array at all. This has do be done by the owning property

doGetElementCount(string $name): int

Gets from the array element $name the count of entries. Note: This routine does not check, if the element is an array at all. This has do be done by the owning property

doGetOffsetExists(string $name, $index): bool

Returns how many entries the array element has. Note: '

doSetValue(string $name, $value)

Performs the setting of the value

doSetIndexedValue(string $name, $index, $value)

Sets in the array property $name the element identified by $index with $value

isDirty(): bool

Returns if the storage was modified.

doCommit()

For cached storages performs the flush of the cache. Has to be called by property.

doRollback()

For cached storages performs the reollback of the cache. Has to be called by property.

doGetIsInitialized(string $name): bool

Returns if this storage was initialized

Optional methods

prepareGetValue(string $name)

Prepares the retrievement of the value

doGetKeys(string $name): array

postprocessSetValue(string $name, $value)

Perfoms action after setting the value