CachedResponseProducer

class CachedResponseProducer(responseCacheSize: Int, clock: Clock) : ResponseProducer

A ResponseProducer subclass that produces responses from cached data

Parameters

responseCacheSize

the maximum size of items to store in the cache

clock

an entity that produces the current unix time

Constructors

CachedResponseProducer
Link copied to clipboard
fun CachedResponseProducer(responseCacheSize: Int, clock: Clock)
the maximum size of items to store in the cache

Functions

cacheResponse
Link copied to clipboard
fun cacheResponse(uri: String, data: Map<String, String>, cacheForMsec: Long = DEFAULT_CACHE_ENTRY_INTERVAL)
canHandleRequest
Link copied to clipboard
open override fun canHandleRequest(request: Metador.Request): Boolean
Returns whether this entity can handle the specified request
produceResponse
Link copied to clipboard
open suspend override fun produceResponse(request: Metador.Request): Result<Map<String, String>, Throwable>
Produces a response from the specified request.