New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

in-memory-database

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

in-memory-database

A simple caching module that works a like memcached. All keys are stored in a single object.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

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

Welcome to in-memory-database module 👋

Version Documentation Maintenance Twitter: el_dimious

Simple caching module that works a like memcached. All keys are stored in a single object.

Install

npm install --save in-memory-database

Usage

const { InMemoryDatabase } = require('in-memory-database');

const client = new InMemoryDatabase();
client.set('key', 'value');
client.get('key');

Docs

class InMemoryDatabase()

Class Methods

These functions are specified in the in-memory-database.

get(key: string): any

Gets a key'svalue.

client.get('key');

set(key: string, value: any): void

Sets a key to value.

client.set('key', 'value');

delete(key: string): void

Deletes a key.

client.delete('key');

mget(keys: string[]): any

Lists all of the keys that defined in the array.

const values = client.mget(['key1', 'key2']);

mset(keyValueMap: Map<string, any>): void

Sets the multiple a keys/values.

const keyValueMap: Map<string, any> = new Map();
keyValueMap.set('key1', 'value1');
keyValueMap.set('key2', {'foo': 'bar', 'baz': 1});
client.mset(keyValueMap);

keys(): string[]

Get all database keys.

const keys = client.keys();

has(key: string): boolean

Defines if we have stored specific key in database.

const isAlreadyThere = client.has('key');

flush(): void

Flush database.

client.flush();

Run tests

npm run test

Author

👤 Dimos Botsaris

Support Me

ko-fi

Show your support

Give a ⭐️ if this project helped you!

Keywords

FAQs

Package last updated on 15 Feb 2022

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