decorate: Decorate the slow function to enable caching

Description Usage Arguments

Description

Decorate the slow function to enable caching

Usage

1
2
decorate(fun, salt = NULL, type = "type", id_col = "id",
  strategy = function(...) {     as.data.frame(purrr::map_df(...)) })

Arguments

fun

function. Function to be wrapped around a caching layer.

salt

character. The names of the other parameters to be supplied to the original function that modify the results. For example, in get_movie_details(id = 100, type = 'film', extended_details = TRUE) extended_details set to true might be returning a larger dataframe.

type

character. Type of id, like customer_id, author_id, song_id etc.

id_col

character. The name of the argument to the original function that acts like id.

strategy

function. Execution strategy. Blinck will map over the supplied ids and then intelligently choose whether to pull from cache or compute from scrath. This functions signature is fn(ids, fn), where ids are the ids you've passed in, and fn is the extraction function, that computes/reads individual value from cache. Default is purrr:::map_df


kirillseva/blink documentation built on May 20, 2019, 10:23 a.m.