Index

RBDataPersistentCache.swift

Classes


RBDataPersistentCache

A cache that persists items to disk.

Properties

A cache that persists items to disk.
static public let defaultMaximumDiskCacheSize Int { get set }

The path to which items are stored.
public var storagePath String { get }

The maximum size in bytes of the cache.
public var maximumCacheSizeInBytes Int { get }

The current size of the cache in bytes.
public var cacheSizeInBytes Int { get }

Functions

Asynchronously stores the given data item.
@param dataItem : The data item to store.
@param key : The unique key to store the item with.
@param group : The group in which to store the item (optional).
@param expiryInterval : The time span after which the item expires.
@param completion : An optional block to be called when storage is complete.
public func storeDataItem(_ dataItem: Data, key: String, group: String?, expiryInterval: TimeInterval, completion: @escaping () -> ()?)

Determines whether a non-expired item is stored for the given key.
@param key : The key to search for.
@returns Whether or not an item was found.
public func dataItemExists(withKey key: String) -> Bool

Determines whether a non-expired item is stored for the given key.
@param key : The key to search for.
@param completion : The completion block that is called with the result.
public func fetchDataItem(withKey key: String, completion: @escaping (_: Data?) -> Void)

Removes the data item stored with the given key.
@param key : The key with which the item stored is to be removed.
public func removeDataItem(withKey key: String)

Removes all stored data items in the cache.
public func removeAllExpiredItems()