You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

25 lines
532 B

var LRU = require("./");
var cache = LRU( {
max: 1,
maxAge: 1000
} );
cache.set( "1234", 1 );
setTimeout( function() {
cache.set( "1234", 2 );
console.log( "testing after 5s: " + cache.get( "1234" ) );
}, 500 );
setTimeout( function() {
console.log( "testing after 9s: " + cache.get( "1234" ) );
}, 900 );
setTimeout( function() {
console.log( "testing after 11s: " + cache.get( "1234" ) );
}, 1100 );
setTimeout( function() {
console.log( "testing after 16s: " + cache.get( "1234" ) );
}, 1600 );