1.0.8 • Published 6 years ago

static-memory v1.0.8

Weekly downloads
10
License
ISC
Repository
-
Last release
6 years ago

Description

static-memory is simple way to cache & retrieve data from RAM

Feature

  • Simple syntax, easy to implements
  • Support cache Function, Async/Promise, and Normal Value

How to use

const cache = require('static-memory');

cache('test', "hello world"); // result : "hello world"

console.log(cache('test')) // result : "hello world"

// other way
for(var i=0, i<3; i++){
    cache(()=>{
        console.log("init");
        return "hello world";
    });
}
/* result : 
    "init"
    "hello world"
    "hello world"
    "hello world"
*/ 

Docs

function (name, onBlank)

  • name ( option ) (string) : name of cache value. If name is null or arguments just have onBlank, it will genarate a hash key by curent function position.
  • onBlank (function) : initValue, it can be result of function, or as primary type, or promise
1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago