Skip to content

Aya-Alabrash/memoizer

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published