superlru
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Super LRU Cache

Simple LRU Cache implementation

features:

  • gzip compression
  • encryption
  • optionally backed by redis

options:

  • maxSize: number - max number of entries in the cache
  • compress: boolean - use gzip compression on cache entries (default: true)
  • encrypt: boolean - use encryption on cache entries (default: false)**
  • initVector: Buffer - specify custom init vector (default: crypto.randomBytes(16))
  • securityKey: Buffer - specify custom security key (default: crypto.randomBytes(32))
  • writeThrough: boolean - write cache entries through to Redis. (default: false)
  • redisConfig: { user: string, pass: string, host: string } - redis connection info. (default: undefined)

** currentlty the only encryption method supported is aes-256-cbc. more can be added in the future.

import { SuperLRU } from 'superlru'

const cache = new SuperLRU<string, { prop1: string, prop2: number }>({ maxSize: 100 })

await cache.set('test', {
  prop1: 'value',
  prop2: 12345.6789,
})
const value = await cache.get('test')

Readme

Keywords

none

Package Sidebar

Install

npm i superlru

Weekly Downloads

7

Version

1.1.1

License

Apache-2.0

Unpacked Size

24.1 kB

Total Files

11

Last publish

Collaborators

  • j4ys0n