Package-level declarations

Optional response caching: io.github.rohang27.thesportsdb.cache.ResponseCache, the in-memory implementation, and the io.github.rohang27.thesportsdb.cache.CachePolicy that sets a time-to-live per kind of data.

Types

Link copied to clipboard
data class CachePolicy(val static: Duration = 7.days, val slow: Duration = 1.days, val medium: Duration = 1.hours, val live: Duration = Duration.ZERO)

Time-to-live for each Freshness. A zero or negative TTL means "don't cache".

Link copied to clipboard

How quickly an endpoint's data changes. Every endpoint is tagged with one of these, and a CachePolicy turns it into a time-to-live.

Link copied to clipboard
class InMemoryResponseCache(maxEntries: Int, now: () -> Long = System::currentTimeMillis) : ResponseCache

A bounded, thread-safe, in-memory LRU cache with per-entry expiry.

Link copied to clipboard
interface ResponseCache

Stores raw response bodies. Keys never contain an API key. Implement this to back the cache with Redis, a database, disk, etc.