How can I cache my query data result with memoise?
I have tried it with my data and it has no difference at all.
this is my function,
runQuery <- function(DB, query, site) {
# Match the pattern and replace it.
dataQuery <- sub("SITE", as.character(site), query)
# Store the result in data1.
data = dbGetQuery(DB, dataQuery)
return(data)
}
memoise_data <- memoise(runQuery)
data1 <- memoise_data(DB, dataQuery, site1)
The plot still takes 21.61824 seconds whether with memoise
or not.
Any ideas?