This adds an option to use a cache for cr_cn (and an approach that could easily be generalised to other request functions). The cache only persists for a single session - yet at least in my use case, that is the most relevant constraint to ensure that (e.g.) functions that fail half-way do not need to repeat requests.
It notionally adds a new dependency (rlang) but that is already required by dplyr etc anyway.
Related Issue
This does not go quite as far as #185 but might be a light-weight first step?
Example
cr_cn(dois = "10.1126/science.169.3946.635", format = "citeproc-json", cache = TRUE)
behaviour unchanged on first call, much faster from second call onward.
Description
This adds an option to use a cache for
cr_cn
(and an approach that could easily be generalised to other request functions). The cache only persists for a single session - yet at least in my use case, that is the most relevant constraint to ensure that (e.g.) functions that fail half-way do not need to repeat requests.It notionally adds a new dependency (
rlang
) but that is already required bydplyr
etc anyway.Related Issue
This does not go quite as far as #185 but might be a light-weight first step?
Example
cr_cn(dois = "10.1126/science.169.3946.635", format = "citeproc-json", cache = TRUE)
behaviour unchanged on first call, much faster from second call onward.