-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #129
- Loading branch information
Showing
6 changed files
with
130 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,50 @@ | ||
% Generated by roxygen2 (4.0.1): do not edit by hand | ||
\name{cache_info} | ||
\alias{cache_info} | ||
\alias{rerequest} | ||
\title{Compute caching information for a response.} | ||
\usage{ | ||
cache_info(r) | ||
|
||
rerequest(r) | ||
} | ||
\arguments{ | ||
\item{r}{A response} | ||
} | ||
\description{ | ||
Compute caching information for a response. | ||
\code{cache_info()} gives details of cacheability of a response, | ||
\code{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). | ||
} | ||
\examples{ | ||
# Never cached, always causes redownload | ||
r1 <- GET("https://www.google.com") | ||
cache_info(r1) | ||
r1$date | ||
rerequest(r1)$date | ||
|
||
# Expires in a year | ||
r2 <- GET("https://www.google.com/images/srpr/logo11w.png") | ||
cache_info(r2) | ||
r2$date | ||
rerequest(r2)$date | ||
|
||
# Has last-modified and etag, so does revalidation | ||
r3 <- GET("http://httpbin.org/cache") | ||
cache_info(r3) | ||
r3$date | ||
rerequest(r3)$date | ||
|
||
# Expires after 5 seconds | ||
\dontrun{ | ||
r4 <- GET("http://httpbin.org/cache/5") | ||
cache_info(r4) | ||
r4$date | ||
rerequest(r4)$date | ||
Sys.sleep(5) | ||
cache_info(r4) | ||
rerequest(r4)$date | ||
} | ||
} | ||
|