2.0.2 • Published 5 years ago

functional-memoize v2.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

functional-memoize

Functional Memoize is a package to implement an approach of a generic memoization of functions from a functional programming point of view.

functional-memoize.cacheWrapper(findInCache, saveInCache, memoizeConfigOptions, functionToMemoize) ⇒ function

Curriable function to wrapp the function to be memoized with a provided cache strategy.

Kind: static method of functional-memoize
Returns: function - - Function that wrapp the functionToMemoize with the strategy of cache. This function is always async, return a Promise. The returned function has an atribute force, this force atribute is a function that force the use of the functionToMemoize and saveit in the cache.

ParamTypeDescription
findInCachefunctionFunction to find in the cache implemented.
saveInCachefunctionFunction to save in the cache implemented.
memoizeConfigOptionsobjectObject to configure the cahe options.
memoizeConfigOptions.ttlnumberTime to live for the memoization by default is 1.
memoizeConfigOptions.ttlMeasurestringMeasure of the time to live, ir use the same as moment (miliseconds, seconds, minutes, hours, days ...) by default is days.
memoizeConfigOptions.functionNamestringThe Implementation consider a unique cached.
functionToMemoizefunctionFunction to be memoized by the cache wrapper.

functional-memoize.inMemoryCacheWrapper(memoizeConfigOptions, functionToMemoize) ⇒ function

Curriable function to wrapp the function to be memoized with a in Memory cache strategy.

Kind: static method of functional-memoize
Returns: function - - Function that wrapp the functionToMemoize with the strategy of cache. This function is always async, return a Promise. The returned function has an atribute force, this force atribute is a function that force the use of the functionToMemoize and saveit in the cache.

ParamTypeDescription
memoizeConfigOptionsobjectObject to configure the cahe options.
memoizeConfigOptions.ttlnumberTime to live for the memoization by default is 1.
memoizeConfigOptions.ttlMeasurestringMeasure of the time to live, ir use the same as moment (miliseconds, seconds, minutes, hours, days ...) by default is days.
memoizeConfigOptions.functionNamestringThe Implementation consider a unique cached.
functionToMemoizefunctionFunction to be memoized by the cache wrapper.

functional-memoize.inMongoCacheWrapper(mongoDBConfig, memoizeConfigOptions, functionToMemoize) ⇒ function

Curriable function to wrapp the function to be memoized with a mongodb cache strategy.

Kind: static method of functional-memoize
Returns: function - - Function that wrapp the functionToMemoize with the strategy of cache. This function is always async, return a Promise. The returned function has an atribute force, this force atribute is a function that force the use of the functionToMemoize and saveit in the cache.

ParamTypeDescription
mongoDBConfigObjectMongoDB configuration options.
mongoDBConfig.mongodbUriStringmongoDB connection string.
mongoDBConfig.mongodbCacheCollectionStringName of the mongoDB collection.
memoizeConfigOptionsObjectObject to configure the cahe options.
memoizeConfigOptions.ttlNumberTime to live for the memoization by default is 1.
memoizeConfigOptions.ttlMeasureStringMeasure of the time to live, ir use the same as moment (miliseconds, seconds, minutes, hours, days ...) by default is days.
memoizeConfigOptions.functionNameStringThe Implementation consider a unique cached.
functionToMemoizefunctionFunction to be memoized by the cache wrapper.
2.0.2

5 years ago

2.0.0

6 years ago

1.1.2

6 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.2

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago