Skip to content
Myr

Added cache Store.Memory#reap()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent e2fee9b · Browse files · 2 files+23 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+23 added−9 removed

  • tests:+7 added−9 removed
  • other:+16 added−0 removed

2 files+23 added−9 removed

modified:lib/express/plugins/cache.js+16 added
modified:spec/spec.plugins.cache.js+7 added-9 removed
104 unmodified lines
105 end106 107 describe '#reap()'108 it 'should destroy caches older than the given age in milliseconds'109 // memory.commit({ id: '1', lastAccess: Number(new Date) - 300 })110 // memory.commit({ id: '2', lastAccess: Number(new Date) - 250 })111 // memory.commit({ id: '3', lastAccess: Number(new Date) - 100 })112 // memory.commit({ id: '4', lastAccess: Number(new Date) })113 // memory.reap(200)114 // memory.store.should.not.have_property '1'115 // memory.store.should.not.have_property '2'116 // memory.store.should.have_property '3'117 // memory.store.should.have_property '4'109 store.set('user:one', '1')110 store.data['user:one'].created = Number(new Date) - 300111 store.set('user:two', '2')112 store.data['user:two'].created = Number(new Date) - 100113 store.reap(200)114 store.get('user:one').should.be_null115 store.get('user:two').should.not.be_null116 end117 end118 end119end