aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket/src/main/webapp/vnfmarket/node_modules/lru-cache/s.js
blob: c2a9e548f211f6bad32e53a5004ed206d23634fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var LRU = require('lru-cache');

var max = +process.argv[2] || 10240;
var more = 1024;

var cache = LRU({
  max: max, maxAge: 86400e3
});

// fill cache
for (var i = 0; i < max; ++i) {
  cache.set(i, {});
}

var start = process.hrtime();

// adding more items
for ( ; i < max+more; ++i) {
  cache.set(i, {});
}

var end = process.hrtime(start);
var msecs = end[0] * 1E3 + end[1] / 1E6;

console.log('adding %d items took %d ms', more, msecs.toPrecision(5));