Companion

object Companion

Functions

Link copied to clipboard
fun components(components: List<String>, separator: String = ":"): CacheKey

A key composed of ordered components joined by separator.

Link copied to clipboard
fun endpoint(endpoint: String, parameters: Map<String, String> = emptyMap()): CacheKey

A key for an endpoint plus sorted parameters, e.g. videos?limit=20&offset=0. Parameters are sorted by name so key identity is independent of insertion order. Names and values are percent-encoded so a literal &/=/? inside a parameter can't be mistaken for a separator and collide with a differently-shaped parameter set (e.g. {"a": "b&c=d"} no longer produces the same key as {"a": "b", "c": "d"}).

Link copied to clipboard
fun url(url: String): CacheKey

A key derived from a URL string.

Link copied to clipboard
fun user(userId: String, resource: String): CacheKey

A key scoped to a userId for a given resource, e.g. user:42:profile.