cache_info() gives details of cacheability of a response, rerequest() re-performs the original request doing as little work as possible (if not expired, returns response as is, or performs revalidation if Etag or Last-Modified headers are present).
cache_info(r)rerequest(r)
Arguments
r: A response
Examples
# Never cached, always causes redownloadr1 <- GET("https://www.google.com")cache_info(r1)r1$date
rerequest(r1)$date
# Expires in a yearr2 <- GET("https://www.google.com/images/srpr/logo11w.png")cache_info(r2)r2$date
rerequest(r2)$date
## Not run:# Has last-modified and etag, so does revalidationr3 <- GET("http://httpbin.org/cache")cache_info(r3)r3$date
rerequest(r3)$date
# Expires after 5 secondsr4 <- GET("http://httpbin.org/cache/5")cache_info(r4)r4$date
rerequest(r4)$date
Sys.sleep(5)cache_info(r4)rerequest(r4)$date
## End(Not run)