https://github.com/nealrichardson/httpcache
  
  
    HTTP query cache for R 
    https://github.com/nealrichardson/httpcache
  
caching http-client logging rstats
        Last synced: 6 months ago 
        JSON representation
    
HTTP query cache for R
- Host: GitHub
 - URL: https://github.com/nealrichardson/httpcache
 - Owner: nealrichardson
 - License: other
 - Created: 2016-02-21T02:17:09.000Z (over 9 years ago)
 - Default Branch: main
 - Last Pushed: 2023-04-12T09:38:32.000Z (over 2 years ago)
 - Last Synced: 2025-03-31T05:26:58.673Z (7 months ago)
 - Topics: caching, http-client, logging, rstats
 - Language: R
 - Homepage: https://enpiar.com/r/httpcache/
 - Size: 126 KB
 - Stars: 12
 - Watchers: 2
 - Forks: 3
 - Open Issues: 5
 - 
            Metadata Files:
            
- Readme: README.md
 - Changelog: NEWS.md
 - License: LICENSE
 
 
Awesome Lists containing this project
- jimsghstars - nealrichardson/httpcache - HTTP query cache for R (R)
 
README
          # httpcache: Query Cache for HTTP Clients
[](https://codecov.io/github/nealrichardson/httpcache?branch=master) [](https://ci.appveyor.com/project/nealrichardson/httpcache) [](https://cran.r-project.org/package=httpcache)
In order to improve performance for HTTP API clients, `httpcache`
provides simple tools for caching and invalidating cache. It includes the
HTTP verb functions `GET`, `PUT`, `PATCH`, `POST`, and `DELETE`, which are drop-in
replacements for those in the [httr](https://httr.r-lib.org) package.
These functions are cache-aware and provide default settings
for cache invalidation suitable for RESTful APIs; the package also
enables custom cache-management strategies. Finally, `httpcache` includes
a basic logging framework to facilitate the measurement of HTTP request
time and cache performance.
## Installing
`httpcache` can be installed from CRAN with
    install.packages("httpcache")
The pre-release version of the package can be pulled from GitHub using the [remotes](https://github.com/r-lib/remotes) package:
    # install.packages("remotes")
    remotes::install_github("nealrichardson/httpcache")
## Getting started
Working with `httpcache` is as simple as loading the package in your interactive session or script instead of `httr`, or, in package development, importing the HTTP verb functions from `httpcache`. `GET()` responses are added to the local query cache; `PUT()`, `PATCH()`, `POST()`, and `DELETE()` requests trigger cache invalidation on the associated resources. You can override that default cache invalidation, and you can command the invalidation explicitly, with the invalidation functions `dropCache()`, `dropPattern()`, and `dropOnly()`. `clearCache()` wipes the cache completely.
See `vignette("httpcache")` for examples of the HTTP cache in practice.
## For developers
The repository includes a Makefile to facilitate some common tasks.
### Running tests
`$ make test`. Requires the [httptest](https://enpiar.com/r/httptest/) package. You can also specify a specific test file or files to run by adding a "file=" argument, like `$ make test file=logging`. `test_package` will do a regular-expression pattern match within the file names. See its documentation in the [testthat](https://testthat.r-lib.org) package.
### Updating documentation
`$ make doc`. Requires the [roxygen2](https://github.com/klutometis/roxygen) package.