js-libp2p/src/metrics/old-peers.js
Jacob Heun f540112835
refactor: stats (#501)
* docs: add initial notes on stats

* feat: initial refactor of stats to metrics

* feat: add support for placeholder metrics

This is helpful for tracking metrics prior to knowing the remote peers id

* fix: add metrics tests and fix issues

* fix: always clear the dial timeout timer

* docs: add metrics to api doc

* chore: apply suggestions from code review

Co-Authored-By: Vasco Santos <vasco.santos@moxy.studio>

* docs: update metrics docs

* fix: call metrics.onDisconnect

* docs(config): add example headers so they appear in the TOC

* docs(config): add metrics configuration

* docs(relay): fix relay configuration docs
2019-12-12 10:29:10 +01:00

16 lines
274 B
JavaScript

'use strict'
const LRU = require('hashlru')
/**
* Creates and returns a Least Recently Used Cache
*
* @param {Number} maxSize
* @returns {LRUCache}
*/
module.exports = (maxSize) => {
const patched = LRU(maxSize)
patched.delete = patched.remove
return patched
}