Storages: Difference between revisions

From Sunhill Framework Documentation
Page created
 
+Textblock
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Incomplete}}
{{Incomplete}}
While properties handle access and validation of data the '''storages''' take care how this data is retrieved or stored.
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.
 
{{:Property storage linkage}}
All storages are based on {{Resource link|Resource=Class|Name=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 ==
 
=== setCacheID(string $id): self ===
Sets an cache id. This can be done from external or in the storage itself for example in the constructor
 
=== getCacheID(): string ===
Returns the cache id
   
=== setCacheTime(int $int): self ===
Sets the current caching time
 
=== getCacheTime(): int ===
Returns the current caching time
   
=== isCachable(): bool ===
Returns if this storage is cachable at all.
 
== Persistance ==
 
=== isDirty(): bool ===
 
=== commit() ===
 
=== rollback() ===
 
== Writing your own storage ==
For details about writing am own storage see [[Writing own storage|here]].
[[Category:Storages]]
[[Category:Properties]]

Latest revision as of 10:39, 22 October 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.

Every property needs exactly one storage. The linkage between property and storage can be done:


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

setCacheID(string $id): self

Sets an cache id. This can be done from external or in the storage itself for example in the constructor

getCacheID(): string

Returns the cache id

setCacheTime(int $int): self

Sets the current caching time

getCacheTime(): int

Returns the current caching time

isCachable(): bool

Returns if this storage is cachable at all.

Persistance

isDirty(): bool

commit()

rollback()

Writing your own storage

For details about writing am own storage see here.