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

best strategy for memoization/cache? #13

Open
moimikey opened this issue Jul 30, 2018 · 0 comments
Open

best strategy for memoization/cache? #13

moimikey opened this issue Jul 30, 2018 · 0 comments

Comments

@moimikey
Copy link

moimikey commented Jul 30, 2018

Hi,

Really enjoying the library for some personal projects. Wanted to know what you'd recommend for caching the ajax request, for example:

const mostStarredRepos = pipe(
  switchMap(() => ajax(`https://api.github.com/users/moimikey/repos?sort=updated`)),
  pluck('response'),
  map(sortByStars),
  memoize(map(arr => arr.slice(0, 5)))
)

or unwrap/rewrap

async function getRecentRepos () {
  if (await getCache('recent')) {
    return getCache('recent')
  }
  // any way to unwrap the pipe?
  // 
  await setCache('recent', recentRepos)
  return recentRepos
}

wanted some 2cents. thanks. /cc @johnlindquist

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