Description Usage Arguments Value Examples
Memory-caching versions of httr verbs that honour cache control headers. If
you need more control over the caching, create your own with caching()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
... |
Arguments passed on to the corresponding httr verb. |
Result of original verb, but from a cache if applicable.
1 2 3 4 5 6 7 8 9 | # Response header specifies two seconds of caching
cached_request <- function() {
try(httc::GET("https://httpbin.org/cache/2"))
}
system.time(cached_request()) # First response from server
system.time(cached_request()) # Second uses cached result
Sys.sleep(2)
system.time(cached_request()) # Re-requested from server
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.