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

flat-cache

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flat-cache

A stupidly simple key/value storage using files to persist some data

  • 1.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39M
decreased by-7.71%
Maintainers
1
Weekly downloads
 
Created

What is flat-cache?

The flat-cache package is a simple disk-based key-value store that allows you to set and get data, cache it on disk, and clear the cache when necessary. It is useful for caching results of expensive operations, storing configuration, or any other use case where a simple persistent key-value store is needed.

What are flat-cache's main functionalities?

Caching data to disk

This feature allows you to cache data to disk by setting a key-value pair and then saving the cache. The data can be retrieved later, even after the process is restarted.

const flatCache = require('flat-cache');
let cache = flatCache.load('myCache');
cache.setKey('key', 'value');
cache.save();

Loading cached data from disk

This feature allows you to load previously saved cache from disk and retrieve the value associated with a specific key.

const flatCache = require('flat-cache');
let cache = flatCache.load('myCache');
let value = cache.getKey('key');

Removing a specific key from the cache

This feature allows you to remove a specific key from the cache and then save the updated cache to disk.

const flatCache = require('flat-cache');
let cache = flatCache.load('myCache');
cache.removeKey('key');
cache.save();

Clearing the entire cache

This feature allows you to clear the entire cache and then save the empty cache to disk, effectively resetting it.

const flatCache = require('flat-cache');
let cache = flatCache.load('myCache');
cache.clearAll();
cache.save();

Other packages similar to flat-cache

Keywords

FAQs

Package last updated on 07 Nov 2018

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