JairusSW / as-lru

LRU (Least Recently Used) Cache Built For AssemblyScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AS-LRU

Very Fast (Least Recently Used) Cache For AssemblyScript

About

  • AssemblyScript Compatible
  • Isomorphic (Browser / Node)
  • Based On Map

Installation

~ npm install as-lru --save

Usage

Basic Usage

import { QuickLRU } from 'as-lru'

const cache = new QuickLRU<string, string>(1000)

cache.set('Example', 'Hello World 🌎')

// Make sure to use cache.has(). Otherwise, it can throw an error.
if (cache.has('Example')) {

    cache.get('Example')
    //=> 'Hello World 🌎' / Undefined If Removed
}

API

new QuickLRU -->> [QuickLRU]

Create A New QuickLRU Instance

As always, please star the repository! πŸ₯³

About

LRU (Least Recently Used) Cache Built For AssemblyScript

License:MIT License


Languages

Language:TypeScript 63.8%Language:JavaScript 20.0%Language:WebAssembly 16.2%