Libraries v5.0.0
    Preparing search index...

    Function cacheTags

    • Creates a tag-based cache middleware.

      On GET requests, the middleware inspects __endpointMeta.cacheTags to compute cache keys. If a valid (non-expired) cache entry exists, the cached response is returned immediately (cloned).

      Successful mutations (POST, PUT, DELETE, PATCH) invalidate entries whose tag names start with any of the endpoint's tag names, including all aliases. Generations also prevent older in-flight reads from repopulating them.

      Parameters

      Returns Middleware

      A Middleware that caches and invalidates by tag.