Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _src/lib/node_cache.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ module.exports = class NodeCache extends EventEmitter
#
set: ( key, value, ttl )=>
# check if cache is overflowing
if (@options.maxKeys > -1 && @stats.keys >= @options.maxKeys)
if (@options.maxKeys > -1 && @stats.keys >= @options.maxKeys && !@data[ key ])
_err = @_error( "ECACHEFULL" )
throw _err

Expand Down
5 changes: 5 additions & 0 deletions _src/test/mocha_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ describe "`#{pkg.name}@#{pkg.version}` on `node@#{process.version}`", () ->
true.should.eql setKey3
return

it "overwrite key", () ->
setKey3 = localCacheMaxKeys.set(state.key3, state.value3, 0)
true.should.eql setKey3
return

return

describe "correct and incorrect key types", () ->
Expand Down