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:
-
Automatic cache static objects such as HTML pages or images for a short amount of time, while not caching other objects None do not cache the object t cache 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 allBasic 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:
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