Description
SPTPersistentCache is an iOS and macOS library from Spotify for caching NSData on disk with a time to live. It uses the file system to store files, each with a cache header that records its TTL, last update time and a redundancy check, so the cache can tell how often a file is accessed, when it was made, whether it has become corrupt, and whether it is stale. The cache is an LRU design, and it can schedule garbage collection to keep disk use within limits for commonly cached data such as images. Each file is separate, so reads and writes to different entries do not need complicated blocking. The README advises using a separate cache for each type of data, with one instance per cache, and suggests creating your own hash for keys, since the key becomes the file name. 10 and later.…
Highlights
- Disk cache for NSData with TTL values
- LRU design with scheduled garbage collection
- Cache header tracks access, age and corruption
- Separate files so reads and writes do not block each other
- Static library or CocoaPods install
Ratings & Reviews
No ratings yet
Be the first to rate SPTPersistentCache.
People also visit
SPTPersistentCache FAQ
What does SPTPersistentCache do?
It caches data on disk with a time to live and manages disk space with garbage collection.
Which platforms are supported?
iOS 8.0 and later, and OS X 10.10 and later.
How do I install it?
Include the Xcode project as a static library, or add it through CocoaPods.
How should I name keys?
The key becomes the file name, so the README suggests creating keys with your own hash function, such as SHA1.
Should I use one cache for everything?
No. The README recommends a separate cache for each type of data, with one instance per cache.
What are the best SPTPersistentCache alternatives?
Popular alternatives to SPTPersistentCache include Zeitgeist, Duply and Macspace Releases. See all SPTPersistentCache alternatives




