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

@tcollinsworth/lrucache

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tcollinsworth/lrucache

lru cache with express middleware for inspection/management

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

LruCache

This lib uses lru-cache.

It provides:

  • Tracks hits and misses on get
  • Express middleware for inspection and management of all caches
    • Statistics - hits, misses, entry count
  • Scheduled periodic pruning and clearing

Usage

const app = express()

const options = {
  periodicClearing: { autoStart: true },
  periodicPruning: { autoStart: true },
  nativeCacheOptions: { max: 10000, ttl: 86400000 },
}

const aCache = new LruCache(options)
const bCache = new LruCache(options)

const lruExpress = new LruCacheExpressMiddleware()

app.use('/lru-cache', lruExpress.getMiddleware())

REST APIs

  • /purgeStale?cacheName=ALL | cacheName
  • /clearCache?cacheName=ALL | cacheName
  • /getOptions?cacheName=ALL | cacheName
  • /getStats?cacheName=ALL | cacheName
  • /resetStats?cacheName=ALL | cacheName

Periodic Scheduling

Uses cronosjs

second, minute, hour, day of month, month, day of week, year
scheduled to run every Saturday @ 8:00:10pm  === '10 0 20 * * 6 *'
/*
  *  *  *  *  *  *  *    Field              Allowed values    Special symbols
  |  |  |  |  |  |  |    -----------------  ---------------   ---------------
  `--|--|--|--|--|--|->  Second (optional)  0-59              * / , -
     `--|--|--|--|--|->  Minute             0-59              * / , -
        `--|--|--|--|->  Hour               0-23              * / , -
           `--|--|--|->  Day of Month       1-31              * / , - ? L W
              `--|--|->  Month              1-12 or JAN-DEC   * / , -
                 `--|->  Day of Week        0-7 or SUN-SAT    * / , - ? L #
                    `->  Year (optional)    0-275759          * / , -

Keywords

FAQs

Package last updated on 05 Jul 2023

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