Skip to content

Can nuster support serve stale and update cache in background when cache is stale? #131

@everyx

Description

@everyx

from #96 (comment)

Let's say we have a cached response of request /test, which has a ttl of 100 seconds.

After 100 seconds, the cache is expired(assume no extend).

Suppose request A '/test' comes in at 101 seconds, another request B comes in at 102 seconds, and request C comes in at 110 seconds. (Assume backend needs 5 seconds to handle the request)
...
2. use use-stale on
A will be forwarded to backend and the cache will be updated.
B will be served use the stale cache
C will be served use the new cache

I want A to use stale cache like B until the cache is updated, how do I configure this?

Background
In my usage scenario, visitors do not have very high requirements for the immediacy of web page updates, that is to say, the stale content can be served, but at this time when cache expires the cache server should update the cache in time, and provide stale before this, just like varnish does when ttl < 0 and stale > 0, but varnish doesn’t support persistence well which nuster does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions