CachingConfig

sttp.client4.caching.CachingConfig
See theCachingConfig companion object
case class CachingConfig(eligibleForCaching: RequestMetadata => Boolean, cacheDuration: (RequestMetadata, ResponseMetadata) => Option[FiniteDuration], cacheKey: RequestMetadata => Array[Byte], serializeResponse: CachedResponse => Array[Byte], deserializeResponse: (Array[Byte]) => Try[CachedResponse])

Configuration for CachingBackend.

Value parameters

cacheDuration

Calculates the duration for which a response should be cached, based on the request and response. A None result means that the response should not be cached. By default uses the max-age cache directive from the Cache-Control header.

cacheKey

Creates the cache key for a request. The default implementation includes the method, URI and headers specified in the Vary header.

deserializeResponse

The function used to deserialize the response from the cache. By default uses JSON deserialization using jsoniter-scala.

eligibleForCaching

Checks if a request is eligible for caching, before it is sent. By default only GET and HEAD requests are eligible.

serializeResponse

The function used to serialize the response to be cached. By default uses JSON serialization using jsoniter-scala.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product