Socket
Socket
Sign inDemoInstall

memo-cache

Package Overview
Dependencies
1
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 1.0.0

test/testCache.js

2

bower.json
{
"name": "memo-cache",
"version": "0.0.2",
"version": "1.0.0",
"homepage": "https://github.com/mrodrig/memo-cache",

@@ -5,0 +5,0 @@ "moduleType": [

@@ -185,3 +185,3 @@ 'use strict';

};
return caches[cacheName].cache[key].value;
return caches[cacheName].options.cloneValues ? clone(value) : value;
}

@@ -214,3 +214,2 @@ return null;

if (cacheName && key && caches[cacheName] && caches[cacheName].cache && caches[cacheName].cache[key]) {
console.log('removing ' + key + ' in ' + cacheName);
var value = caches[cacheName].cache[key].value;

@@ -217,0 +216,0 @@ delete caches[cacheName].cache[key];

@@ -5,3 +5,3 @@ {

"description": "A memoization and caching library for NodeJS",
"version": "0.0.2",
"version": "1.0.0",
"repository": {

@@ -29,4 +29,3 @@ "type": "git",

"mocha": "~1.14.0",
"should": "~2.0.2",
"async": "~0.2.9"
"should": "~2.0.2"
},

@@ -33,0 +32,0 @@ "engines": {

@@ -140,6 +140,21 @@ # Node Memoization/Caching Library

####Memoization:
#####memoCache.memoize(function, options)
* ```cacheName``` String - name of the cache
* ```options``` Object - options for the cache, specifying any of the following:
* ```cloneValues``` Boolean - should returned values be clones of the original? [Default: false]
* ```maxSize``` Integer - maximum number of keys to store in this cache; if null, then unlimited [Default: null]
* ```memoHashFunction``` Function - used to map the input arguments to a String. The result of this function becomes the key for the function result value
```javascript
require memoCache = require('memo-cache');
var myFunction = function (aString) { console.log('cache miss!'); return aString; };
var myFunctionMemoized = memoCache.memoize(myFunction, {maxSize: 10});
myFunctionMemoized('testing'); // => 'testing' (Prints 'cache miss!' to the console)
myFunctionMemoized('testing'); // => 'testing' (Does not print 'cache miss!')
```
## Tests
*No tests are currently implemented while this module is in development*
```bash

@@ -146,0 +161,0 @@ $ npm test

@@ -1,3 +0,7 @@

describe('tag-cloud Module', function() {
return true;
var cacheTests = require('./testCache');
memoTests = require('./testMemoize');
describe('memo-cache Module', function() {
cacheTests.runTests();
memoTests.runTests();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc