Cache
public protocol Cache : AnyObject, EventDispatcherProtocol
The caching API allows to store a streaming source on the user’s device.
-
Indicates the
CacheStatus.Declaration
Swift
var status: CacheStatus { get } -
The list of all caching tasks.
Remark
The list should be regarded as read-only. To remove a task, invokeCachingTask.remove().Declaration
Swift
var tasks: [CachingTask] { get } -
Creates a
CachingTaskwhich will be used to cache the provided source, abiding to the provided parameters.Declaration
Swift
func createTask(source: SourceDescription, parameters: CachingParameters?) -> CachingTask?Parameters
sourceThe source to be cached.
parametersThe optional caching parameters.
Return Value
The created
CachingTask. -
Adds the event listener of the given
EventType.Remark
When attaching a listener on the wrong object the application will crash.
Declaration
Swift
func addEventListener<E>(type: EventType<E>, listener: @escaping (E) -> ()) -> EventListener where E : EventProtocolParameters
typeEventTypeof the added event listener. SeeCacheEventTypesfor possible values.listenerClosure called when event is dispatched.
Return Value
The newly added
EventListener. -
Removes the event listener for the given
EventType.Declaration
Swift
func removeEventListener<E>(type: EventType<E>, listener: EventListener) where E : EventProtocolParameters
typeEventTypeof the event listener to be removed. SeeCacheEventTypesfor possible values.listenerEventListenerwhich was added byaddEventListener(...).