Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 740 Bytes

README.MD

File metadata and controls

40 lines (29 loc) · 740 Bytes

Memoizer

This repository is a basic Memoizer implementation.

Memoization is best technique to save on memory or CPU cycles when we deal with repeated operations.

Basically, if the function is called with the same inputs, Memoizer helps directly return the result in the cache.

Here, i use a popular npm package memoizee.

Install

npm i @aya_ab/memoize
yarn add @aya_ab/memoize

Example

import { memoize } from "./memoize";
...
class MyClass {
  @memoize()
  myFunction(a = undefined, b = undefined, c = undefined) {
    var result = a + " " + b + " " + c;
    this.helloFunc();
    return result;
  }
  helloFunc() {}
}
...

Test

npm run test