Expiration policy

More about the expiration policy

expiration-policy:          # 1.
  type: access              # 1.1
  time:                     # 1.2
    expire-after: 1m        # 1.2.1
  size:                     # 1.3
    maximum: 1000           # 1.3.1

Httpstub provides three basic types of evictions: size-based eviction, time-based eviction, and access-based eviction.

size-based - Controls that the recorder should not store recordings larger than a certain size. The recorder storage will attempt to delete recordings that have not been used recently or very often. Warning: the storage may delete recordings before this limit is exceeded - usually when the storage size is approaching the limit.

Allowed settings:

Name
Type
Available values

maximum

java.lang.Integer

1, 500, 30000

time-based - When using this policy, record retention ceases after a specified amount of time has elapsed since the record was created. This can be useful if cached data becomes obsolete after a certain amount of time. Time expiration is performed with periodic maintenance during writes and occasionally during reads.

Allowed settings:

Name
Type
Available values
Comment

expire-after

java.time.Duration

1h, 5m, 30s, 1000ms

Parsing is done through org.springframework.boot.convertÑŽDurationStyle#detectAndParse(String)

access-based - Evict data only after a specified time has elapsed since the last read access to the record. Note that the order of eviction of records will be similar to the order of eviction by size.

This policy has no settings

Examples

Expiration policy - time

Entry expires 1 minute after writing

Expiration policy - size

Stores one thousand records

Expiration policy - access

Entry expires after access, stored for 1 day and unlimited size

Last updated