Socket
Socket
Sign inDemoInstall

cache-entity

Package Overview
Dependencies
8
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cache-entity

Cache remote resources in a key-value store


Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Install size
491 kB
Created
Weekly downloads
 

Readme

Source

Cache Entity

Cache remote resources in a key-value store

Install

npm install cache-entity

Usage

    import CacheEntity from 'cache-entity'

    // Init
    const cache = new CacheEntity({
        users: 'https://jsonplaceholder.typicode.com/users/{key}',
        todos: 'https://jsonplaceholder.typicode.com/todos/{key}',
    })

    // Add data 
    cache.add('todos', { 1: { name: 'Buy apples' }, 2: { name: 'Fix bugs' } })

    // Lookup 
    const todo1 = await cache.lookup('todos', 1) // will not fetch
    const todo2 = await cache.lookup('todos', 3) // will fetch
    const todo3 = await cache.lookup('todos', 3) // will not fetch
    

Changelog

  • 1.0.0
    • Initial release :tada:

License

ISC License

FAQs

Last updated on 04 Jun 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc