Storage
public protocol Storage
A Storage is used to store and retrieve Records. It can be either in memory or on disk.
-
The
capacity
defines the capacity of the storage.Declaration
Swift
var capacity: StorageCapacity { get set }
-
A
RecordModifier
that can modify eachRecord
before it is persisted to aStorage
. This allows you to modify requests and responses after they are executed but before they are passed along to other florets.Declaration
Swift
var preStorageRecordModifier: RecordModifier? { get set }
-
Initialize a Store with capacity and optional pre storage record modifier
Declaration
Swift
init(capacity: StorageCapacity, preStorageRecordModifier: RecordModifier?)
Parameters
capacity
StorageCapacity
of the storagepreStorageRecordModifier
RecordModifier
that can modify aRecord
before it is stored -
Adds a record to the storage. Updates a possibly existing record. A record is the same if it’s identifier is the same.
Declaration
Swift
func store(_ record: Record)
Parameters
record
The record to add to the storage.
-
Returns a number of records after the referenced record. Records are sorted by order there were added to the storage, Might return less than
count
if there are no more records.Parameters
count
The number of records that should be returned.
after
The record after which there should be new records returned.
Return Value
The records after the referenced record, sorted from latest to oldest.