microlinkhq / open

4 stars 2 forks source link

Caching policies #27

Open Kikobeats opened 4 years ago

Kikobeats commented 4 years ago

Currently, the API offers two parameters for control the cache layer:

Need to deprecate force in favor of policy API parameters with the following possible values:

cache-first|standard|auto

This is the default value where we always try reading data from your cache first. If the value is not present in the cache, a new fresh cache copy will be generated and served.

refresh|fresh

It invalidates and serves a new fresh cache copy. It's the current behavior of force.

stale

It serves cache copy if it's present meanwhile asynchronously refreshes the value. It's equivalent to stale-while-revalidate.

only-if-cached

If the cache copy is a HIT, serve it; otherwise, it doesn't create a cached copy of the resource, returning a 404.

no-cache

It disables the cache level, serving always a fresh copy that will be not stored.

no-store

Similar to force but not creating a new fresh cache entry.

Inspiration