Print "cached" instead of timing info for cached requests
Change-Id: I64e87ffee251aae9bc09516b47054f856f58f66e
diff --git a/R/KorAPConnection.R b/R/KorAPConnection.R
index f941bdd..90f72c1 100644
--- a/R/KorAPConnection.R
+++ b/R/KorAPConnection.R
@@ -149,6 +149,7 @@
if (kco@cache) {
parsed <- R.cache::loadCache(dir=KorAPCacheSubDir(), key=list(url, kco@accessToken))
if (!is.null(parsed)) {
+ parsed$meta$cached <- "local"
return(parsed)
}
}
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index 7a59ae7..cf848f0 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -188,8 +188,10 @@
log.info(verbose, "Searching \"", query, "\" in \"", vc, "\"", sep =
"")
res = apiCall(kco, paste0(requestUrl, '&count=0'))
- log.info(verbose, " took ", res$meta$benchmark, "\n", sep =
- "")
+ if(!is.null(res$meta$cached))
+ log.info(verbose, " [cached]\n")
+ else
+ log.info(verbose, " took ", res$meta$benchmark, "\n", sep = "")
if (as.df)
data.frame(
query = query,