Hold values or objects in volatile memory for a pre-determined amount of time.
Stash a resource against an instance of UUID
.
struct TestValue: Identifiable {
let id: UUID
let image: UIImage
}
let cache = Cache<TestValue>()
cache.stash(value, duration: .short)
// retrieve using the same `id` value.
let value: TestValue? = cache.resource(for: value.id)
Use the Swift Package Manager. See Releases.