Hold values or objects in volatile memory for a pre-determined amount of time

Cache

Hold values or objects in volatile memory for a pre-determined amount of time.

Usage

Stash a resource against an instance of UUID.

let cache = Cache<UIImage>()
cache.stash(image, with: id, duration: .short)

// retrieve using the same `id` value.
let image: UIImage? = cache.resource(for: id)

Installation

Use the Swift Package Manager. See Releases.

GitHub

View Github