Edit this page

up.network up.cache.alias(oldRequest, newRequest)
JavaScript function

This feature is experimental. Please share your experiences so we know what to keep or change.

Makes the cache assume that newRequest has the same response as the already cached oldRequest.

Unpoly uses this internally when the user redirects from /old to /new. In that case, both /old and /new will cache the same response from /new.


Parameters

oldRequest
required

The earlier request or request options.

newRequest
required

The new request or request options.


Return value

If an alias could be registered, newRequest is returned.

If oldRequest wasn't found in the cache, undefined is returned.