Skip to content

best strategy for memoization/cache? #13

@moimikey

Description

@moimikey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions