CachePersistence

CachePersistence

is an option for CloudObject and related cloud functions that specifies the time duration for which a response is cached by a client or on the server.

Details

  • CachePersistence->t specifies that cached values should be kept for t seconds.
  • CachePersistence supports Quantity objects.
  • Possible settings for CachePersistence include:
  • Automaticcache static objects such as HTML pages or images for a short amount of time, while not caching other objects
    Nonedo not cache the object
    tcache the object for t seconds
    Quantity[]cache the object for the specified quantity of time
  • The cloud server adds a Cache-Control header to the HTTP response based on CachePersistence, which is taken into account by web browsers to cache the response.
  • CachePersistence can be used with Delayed to specify how long to keep server-side cached versions of computations.

Examples

open allclose all

Basic Examples  (3)

Export an image to cloud that will be cached in the browser for 1 day:

Check the value of the "cache-control" response header to verify the time duration for which the object will be cached by a web browser:

Deploy an expression that always evaluates on request:

Deploy an expression that is cached for up to 10 seconds:

Request the expression continuously for several seconds to confirm that the expression is only updated approximately every 10 seconds:

Scope  (1)

Deploy a delayed evaluation with a server-side cache of 5 seconds, then redeploy it with no server-side cache. The redeployment invalidates the previous server-side cache:

Wolfram Research (2015), CachePersistence, Wolfram Language function, https://reference.wolfram.com/language/ref/CachePersistence.html.

Text

Wolfram Research (2015), CachePersistence, Wolfram Language function, https://reference.wolfram.com/language/ref/CachePersistence.html.

CMS

Wolfram Language. 2015. "CachePersistence." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CachePersistence.html.

APA

Wolfram Language. (2015). CachePersistence. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CachePersistence.html

BibTeX

@misc{reference.wolfram_2023_cachepersistence, author="Wolfram Research", title="{CachePersistence}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/CachePersistence.html}", note=[Accessed: 29-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_cachepersistence, organization={Wolfram Research}, title={CachePersistence}, year={2015}, url={https://reference.wolfram.com/language/ref/CachePersistence.html}, note=[Accessed: 29-March-2024 ]}