Storages: Difference between revisions

From Sunhill Framework Documentation
added some methods
some more methods
Line 2: Line 2:
While [[properties]] handle access and validation of data the '''storages''' take care how this data is retrieved or stored. A storage does not necessarily take or write to a persistant medium but can also retrieve informations from the system or calculate its value. The storage does not need to check for access rights or validate the input data this is done by the connected property.
While [[properties]] handle access and validation of data the '''storages''' take care how this data is retrieved or stored. A storage does not necessarily take or write to a persistant medium but can also retrieve informations from the system or calculate its value. The storage does not need to check for access rights or validate the input data this is done by the connected property.


All storages are based on AbstractStorage.
All storages are based on {{Resource link|Resource=Class|Name=AbstractStorage}}.


== Retrieve data ==
== Retrieve data ==
=== getValue(string $name) ===
=== getValue(string $name) ===
Returns the value with the id $name. If it exists and the entry is still valid if Returns it from the cache.
Example:
$storage->getValue("test"); // Returns the value of test


=== getIndexedData(string name, mixed $index) ===
=== getIndexedData(string name, mixed $index) ===
Line 16: Line 20:


== Write data ==
== Write data ==
=== setValue(string $name, $value) ===
=== setIndexedValue(string $name, mixed $index, $value) ===


== Handle metadata ==
== Handle metadata ==
Line 21: Line 29:
== Caching ==
== Caching ==


== Persistance ==
=== isDirty(): bool ===
=== commit() ===
=== rollback() ===
[[Category:Storages]]
[[Category:Storages]]
[[Category:Properties]]
[[Category:Properties]]

Revision as of 13:09, 30 September 2024


This page is incomplete

While properties handle access and validation of data the storages take care how this data is retrieved or stored. A storage does not necessarily take or write to a persistant medium but can also retrieve informations from the system or calculate its value. The storage does not need to check for access rights or validate the input data this is done by the connected property.

All storages are based on AbstractStorage.

Retrieve data

getValue(string $name)

Returns the value with the id $name. If it exists and the entry is still valid if Returns it from the cache.

Example:

$storage->getValue("test"); // Returns the value of test

getIndexedData(string name, mixed $index)

getElemenCount(string $name): int

getKeys(string $name)

getOffsetExists(string $name, mixed $offset): bool

Write data

setValue(string $name, $value)

setIndexedValue(string $name, mixed $index, $value)

Handle metadata

Caching

Persistance

isDirty(): bool

commit()

rollback()