32.0.0 • Published 1 year ago

tachyon-utils-mem1 v32.0.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
1 year ago

tachyon-utils-mem

Convenience wrappers around the mem library.

Installation

$ yarn add tachyon-utils-mem

Usage

This package exposes three main memoization strategies:

  • simple: shallow comparison of first argument to a function
  • deep: deep comparison of all arugments to a function
  • lead object keys: shallow comparison of the values of specific keys of the object that is the first argument to a function

Additionally, there is a custom strategy that lets user build cache keys themselves based on the functions args.

These strategies come in both bottomless ("all") and limited ("some", via LRU culling) cache sizes.

Thus, the following functions are available:

  • memoizeSimpleAll
  • memoizeSimpleSome
  • memoizeDeepAll
  • memoizeDeepSome
  • memoizeLeadObjKeysAll
  • memoizeLeadObjKeysSome
  • memoizeCustomAll
  • memoizeCustomSome