memoize-fs
Advanced tools
Comparing version 0.1.10 to 0.2.0
@@ -56,3 +56,3 @@ 'use strict'; | ||
var salt = opt.salt || '', | ||
fnStr = String(fn), | ||
fnStr = (opt.noBody ? '' : String(fn)), | ||
argsStr, | ||
@@ -59,0 +59,0 @@ hash; |
{ | ||
"name": "memoize-fs", | ||
"version": "0.1.10", | ||
"version": "0.2.0", | ||
"description": "memoize/cache in file system solution for Node.js", | ||
@@ -5,0 +5,0 @@ "author": "Boris Diakur <contact@borisdiakur.com> (https://github.com/borisdiakur)", |
@@ -108,3 +108,3 @@ # memoize-fs | ||
The cacheId option which you can specify during momoization of a function resolves to the name of a subfolder created inside the root cache folder. Cached function calls will be cached inside that folder: | ||
The `cacheId` option which you can specify during momoization of a function resolves to the name of a subfolder created inside the root cache folder. Cached function calls will be cached inside that folder: | ||
@@ -117,3 +117,3 @@ ```javascript | ||
Functions may have references to variables outside their own scope. As a consequence two functions which look exactly the same (they have the same function signature and function body) can return different results even when executed with identical arguments. In order to avoid the same cache being used for two different functions you can use the salt option which mutates the hash key created for the memoized function which in turn defines the name of the cache file: | ||
Functions may have references to variables outside their own scope. As a consequence two functions which look exactly the same (they have the same function signature and function body) can return different results even when executed with identical arguments. In order to avoid the same cache being used for two different functions you can use the `salt` option which mutates the hash key created for the memoized function which in turn defines the name of the cache file: | ||
@@ -126,3 +126,3 @@ ```javascript | ||
The force option forces the re-execution of an already memoized function and the re-caching of its outcome: | ||
The `force` option forces the re-execution of an already memoized function and the re-caching of its outcome: | ||
@@ -136,3 +136,4 @@ ```javascript | ||
memoize-fs tries to serialize the arguments of the memoized function in order to create a hash which is used as the name of the cache file to be stored or retrieved. | ||
If you want memoize-fs to use a custom key instead of letting it serialize the arguments, you can pass the key in the serialize option to memoize: | ||
The hash is created from the serialized arguments, the function body and the [salt](https://github.com/borisdiakur/memoize-fs#salt) (if provided as an option). | ||
If you want memoize-fs to use a custom key instead of letting it serialize the arguments, you can pass the key in the `serialize` option to memoize-fs: | ||
@@ -149,2 +150,7 @@ ```javascript | ||
#### noBody | ||
The hash is created from the serialized arguments, the function body and the [salt](https://github.com/borisdiakur/memoize-fs#salt) (if provided as an option). | ||
If for some reason you want to omit the function body when generating the hash, set the option `noBody` to `true`. | ||
### Manual cache invalidation | ||
@@ -151,0 +157,0 @@ |
25116
199