Cache

3.0.0

A lightweight Swift library for caching Identifiable values with optional expiry, supporting both in-memory and file-backed storage. Designed for testability, composability, and use with swift-dependencies.
nashysolutions/cache

What's New

Release 3.0.0

2023-02-08T09:57:55Z

See Changelog.

Cache

iOS macOS

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

Usage

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)

Installation

Use the Swift Package Manager. See Releases.

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Jun 15 2025 03:15:38 GMT-0900 (Hawaii-Aleutian Daylight Time)