ThemeParks.wiki Parks API - v2.0.0
    Preparing search index...

    Function setMethodCacheObserver

    • Report every call served from the method cache to observer: a call of a @cache method, or of CacheLib.wrap(), that finds a stored result and so does not run the method. null switches the report off. A synchronous observer runs as part of the hit, while an async one is not awaited. An error it throws or rejects with is logged and never affects the cached result.

      A call that shares the running execution of a concurrent miss for the same key, from any instance, is not reported, just as neither HTTP hook sees a request the @http in-flight deduplication answers.

      The cached value is left out, since it is the object the caller receives and, for a sign-in method, a token or credentials. A synchronous observer reads a copy with CacheLib.get(hit.key). caller.args and the key, built from the arguments by default and from config by some parks, can carry secrets, so redact them before storing anything. An observer must not call a @cache method or CacheLib.wrap(), not even through another method, since a hit there calls the observer again without end.

      Parameters

      Returns void