Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow local caching of API calls #69

Closed
MarkEdmondson1234 opened this issue Jun 5, 2017 · 5 comments
Closed

Allow local caching of API calls #69

MarkEdmondson1234 opened this issue Jun 5, 2017 · 5 comments

Comments

@MarkEdmondson1234
Copy link
Owner

In now for mock tests, why not be available for all API requests? cache long running API fetches that can restart where a 500 error crops up

@MarkEdmondson1234
Copy link
Owner Author

Working on googleAnalyticsR tests https://github.com/MarkEdmondson1234/googleAnalyticsR/issues/76 - now to try the others

@MarkEdmondson1234
Copy link
Owner Author

Need to have easy way to turn off cache for API calls that can''t be e.g. task queue checks, something like gar_skip_cache()

@MarkEdmondson1234
Copy link
Owner Author

MarkEdmondson1234 commented Jun 10, 2017

Hmm but task queues do need to be cached when READY. Its going to need an argument and changes to the API function code, perhaps a new flag for gar_api_generator()

Pass a function to check? If req$task$status != "READY" ? Its pre-parsing. Only cache when response meets special condition.

Usually the function is something like

cache_condition <- function(req){
  if(req$status == 200){
     TRUE
 } else {
  FALSE
}
}

but you should have option to pass custom such as:

cache_condition <- function(req){
  if(req$content$task$status == "DONE"){
     TRUE
 } else {
  FALSE
}
}

@MarkEdmondson1234
Copy link
Owner Author

Obviously there is already an R package made by hadley for this https://github.com/r-lib/memoise

@MarkEdmondson1234
Copy link
Owner Author

I think this works r-lib/memoise#46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant