Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/decred/dcrd/lru

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/decred/dcrd/lru

  • v1.1.3
  • Source
  • Go
  • Socket score

Version published
Created
Source

lru

Build Status ISC License Doc

Package lru implements generic least-recently-used caches with near O(1) perf.

LRU Cache

A least-recently-used (LRU) cache is a cache that holds a limited number of items with an eviction policy such that when the capacity of the cache is exceeded, the least-recently-used item is automatically removed when inserting a new item. The meaning of used in this implementation is either accessing the item via a lookup or adding the item into the cache, including when the item already exists.

External Use

This package has intentionally been designed so it can be used as a standalone package for any projects needing to make use of well-tested and concurrent safe least-recently-used caches with near O(1) performance characteristics for lookups, inserts, and deletions.

Installation and Updating

This package is part of the github.com/decred/dcrd/lru module. Use the standard go tooling for working with modules to incorporate it.

Examples

  • Basic Cache Usage Demonstrates creating a new cache instance, inserting items into the cache, causing an eviction of the least-recently-used item, and removing an item.

  • Basic KV Cache Usage Demonstrates creating a new k/v cache instance, inserting items into the cache, causing an eviction of the least-recently-used item, and removing an item.

License

Package lru is licensed under the copyfree ISC License.

FAQs

Package last updated on 13 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc