Skip to content
This repository was archived by the owner on Aug 23, 2019. It is now read-only.

feat: swap quick-lru by hashlru #259

Merged
merged 1 commit into from
Jun 6, 2018
Merged
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"async": "^2.6.0",
"big.js": "^5.0.3",
"debug": "^3.1.0",
"hashlru": "^2.2.1",
"interface-connection": "~0.3.2",
"ip-address": "^5.8.9",
"libp2p-circuit": "~0.2.0",
Expand All @@ -68,8 +69,7 @@
"once": "^1.4.0",
"peer-id": "~0.10.7",
"peer-info": "~0.14.1",
"pull-stream": "^3.6.7",
"quick-lru": "^1.1.0"
"pull-stream": "^3.6.7"
},
"contributors": [
"Arnaud <[email protected]>",
Expand Down
6 changes: 4 additions & 2 deletions src/stats/old-peers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const LRU = require('quick-lru')
const LRU = require('hashlru')

/**
* Creates and returns a Least Recently Used Cache
Expand All @@ -9,5 +9,7 @@ const LRU = require('quick-lru')
* @returns {LRUCache}
*/
module.exports = (maxSize) => {
return new LRU({ maxSize: maxSize })
const patched = LRU(maxSize)
patched.delete = patched.remove
return patched
}