A delightful on-disk cache for iOS/watchOS/tvOS written in Swift, backed by NSCache for performance and expiry support.
AwesomeCache is a Swift-based on-disk caching library for iOS, watchOS, and tvOS applications. It provides a simple, synchronous API to persistently cache objects, combining NSCache for in-memory performance with disk storage for durability across app sessions. It solves the problem of managing cached data with automatic expiry and cleanup.
iOS, watchOS, and tvOS developers who need a straightforward, persistent caching solution for their Swift applications, particularly those handling API responses or data that benefits from expiry policies.
Developers choose AwesomeCache for its sync-first API design that simplifies reasoning about cache state, its built-in support for object expiry with automatic cleanup, and its seamless combination of in-memory (NSCache) and on-disk persistence for reliable performance.
Delightful on-disk cache (written in Swift)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The synchronous API design makes it easy to reason about cache contents, as emphasized in the README's 'Sync by design' section, reducing complexity for developers.
Supports flexible expiry policies like time intervals and specific dates, with automatic removal of expired objects on access, detailed in the 'Cache expiry' part of the README.
Includes a cacheBlock method specifically for caching asynchronous tasks like network responses with configurable durations, simplifying common use cases as shown in the 'Awesome API Caching' section.
Internally uses a concurrent dispatch queue to ensure thread safety while maintaining performance, as mentioned in the sync API explanation, balancing reliability and speed.
Despite automatic removal on access, the README admits developers must regularly call removeExpiredObjects to clean up disk space, adding maintenance overhead.
The synchronous design means cache operations can block the UI thread if not manually offloaded, a trade-off acknowledged in the README with suggested workarounds.
Only supports iOS, watchOS, and tvOS, missing macOS and other platforms, which restricts its use in broader Apple ecosystem or cross-platform projects.