# spotify/SPTPersistentCache

Everyone tries to implement a cache at some point in their iOS app’s lifecycle, and this is ours.

Repository: https://github.com/spotify/SPTPersistentCache
Canonical: https://ross.abutalabs.com/products/sptpersistentcache
Language: Objective-C
License: Apache-2.0
License Family: permissive
Last push: 2026-07-15T22:36:03+00:00

## Health v2 (maintenance only)
Score: 83/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 92, release rhythm 61, longevity 100
- inputs: {"age_days": 3849, "days_push": 49, "days_rel": 49, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1246, forks 74 (observed 2026-08-28T04:04:07.284343+00:00)

## What it is
SPTPersistentCache is an Objective-C library from Spotify for caching NSData on disk with TTL values and LRU disk-management semantics. It stores each entry as a separate file with a cache header tracking TTL, access frequency, and corruption checks, plus scheduled garbage collection.

## Use cases
- cache images on disk in an iOS app
- persist downloaded data with a time to live
- add an LRU disk cache to an iOS or macOS app
- limit how much disk space cached data uses
- cache remote files without blocking concurrent reads and writes
- inspect and strip cache headers from cached files

## When to choose
- you need a battle-tested disk cache for NSData in an iOS or macOS app
- you want TTL-based expiry and automatic garbage collection of cached files
- you cache different data types and want separate per-type cache instances

## When to avoid
- you need an in-memory-only cache
- your app targets platforms beyond iOS/macOS or uses Swift-only tooling without Objective-C interop
- you need encrypted or compressed caching

## Facets
- artifact type: library
- maturity: maintenance
- function: caching, file-system
- domain: mobile-development, developer-tools
- platform: -
- tags: objective-c, lru-cache, disk-cache, ttl, cocoapods, garbage-collection, ios, macos

## Member repositories
- spotify/SPTPersistentCache (main) score 83

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:07.284343+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:08:05.727889+00:00, confidence not recorded.
  - readme: https://github.com/spotify/SPTPersistentCache (fetched 2026-08-28T04:04:07.284343+00:00, sha 085cbd8c185c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
