FlexStorageInterface
in
Defines Flex Storage layer.
Tags
Table of Contents
Methods
- __construct() : mixed
- StorageInterface constructor.
- copyRow() : bool
- createRows() : array<string|int, mixed>
- Create new rows into the storage.
- deleteRows() : array<string|int, mixed>
- Delete rows from the storage.
- getExistingKeys() : array<string|int, mixed>
- Returns associated array of all existing storage keys with a timestamp.
- getKeyField() : string
- getMediaPath() : string|null
- Get filesystem path for the collection or object media.
- getMetaData() : array<string|int, mixed>
- getStoragePath() : string|null
- Get filesystem path for the collection or object storage.
- hasKey() : bool
- Check if the key exists in the storage.
- hasKeys() : array<string|int, bool>
- Check if the key exists in the storage.
- readRows() : array<string|int, mixed>
- Read rows from the storage.
- renameRow() : bool
- replaceRows() : array<string|int, mixed>
- Replace rows regardless if they exist or not.
- updateRows() : array<string|int, mixed>
- Update existing rows in the storage.
Methods
__construct()
StorageInterface constructor.
public
__construct(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
copyRow()
public
copyRow(string $src, string $dst) : bool
Parameters
- $src : string
- $dst : string
Return values
boolcreateRows()
Create new rows into the storage.
public
createRows(array<string|int, mixed> $rows) : array<string|int, mixed>
New keys will be assigned when the objects are created.
Parameters
- $rows : array<string|int, mixed>
-
List of rows as
[row, ...].
Return values
array<string|int, mixed> —Returns created rows as `[key => row, ...] pairs.
deleteRows()
Delete rows from the storage.
public
deleteRows(array<string|int, mixed> $rows) : array<string|int, mixed>
Parameters
- $rows : array<string|int, mixed>
-
Array of
[key => row, ...]pairs.
Return values
array<string|int, mixed> —Returns deleted rows. Note that non-existing rows have null as their value.
getExistingKeys()
Returns associated array of all existing storage keys with a timestamp.
public
getExistingKeys() : array<string|int, mixed>
Return values
array<string|int, mixed> —Returns all existing keys as [key => [storage_key => key, storage_timestamp => timestamp], ...].
getKeyField()
public
getKeyField() : string
Return values
stringgetMediaPath()
Get filesystem path for the collection or object media.
public
getMediaPath([string|null $key = null ]) : string|null
Parameters
- $key : string|null = null
-
Optional storage key.
Return values
string|null —Path in the filesystem. Can be URI or null if media isn't supported.
getMetaData()
public
getMetaData(array<string|int, string> $keys[, bool $reload = false ]) : array<string|int, mixed>
Parameters
- $keys : array<string|int, string>
- $reload : bool = false
Return values
array<string|int, mixed>getStoragePath()
Get filesystem path for the collection or object storage.
public
getStoragePath([string|null $key = null ]) : string|null
Parameters
- $key : string|null = null
-
Optional storage key.
Return values
string|null —Path in the filesystem. Can be URI or null if storage is not filesystem based.
hasKey()
Check if the key exists in the storage.
public
hasKey(string $key) : bool
Parameters
- $key : string
-
Storage key of an object.
Return values
bool —Returns true if the key exists in the storage, false otherwise.
hasKeys()
Check if the key exists in the storage.
public
hasKeys(array<string|int, string> $keys) : array<string|int, bool>
Parameters
- $keys : array<string|int, string>
-
Storage key of an object.
Return values
array<string|int, bool> —Returns keys with true if the key exists in the storage, false otherwise.
readRows()
Read rows from the storage.
public
readRows(array<string|int, mixed> $rows[, array<string|int, mixed>|null &$fetched = null ]) : array<string|int, mixed>
If you pass object or array as value, that value will be used to save I/O.
Parameters
- $rows : array<string|int, mixed>
-
Array of
[key => row, ...]pairs. - $fetched : array<string|int, mixed>|null = null
-
Optional reference to store only fetched items.
Return values
array<string|int, mixed> —Returns rows. Note that non-existing rows will have null as their value.
renameRow()
public
renameRow(string $src, string $dst) : bool
Parameters
- $src : string
- $dst : string
Return values
boolreplaceRows()
Replace rows regardless if they exist or not.
public
replaceRows(array<string|int, mixed> $rows) : array<string|int, mixed>
All rows should have a specified key for replace to work properly.
Parameters
- $rows : array<string|int, mixed>
-
Array of
[key => row, ...]pairs.
Return values
array<string|int, mixed> —Returns both created and updated rows.
updateRows()
Update existing rows in the storage.
public
updateRows(array<string|int, mixed> $rows) : array<string|int, mixed>
Parameters
- $rows : array<string|int, mixed>
-
Array of
[key => row, ...]pairs.
Return values
array<string|int, mixed> —Returns updated rows. Note that non-existing rows will not be saved and have null as their value.