4 min readUpdated

Memoz

Key-value data in fast memory connected to persistent disk storage.

Memoz

npm version  https://img.shields.io/npm/dm/memoz.svg

Memoz is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.

  1. Installation
  2. Usage
  3. Methods

Installation

npm i memoz
// or
yarn add memoz

Usage

const Memoz = require('memoz')
// Or
import Memoz from 'memoz'

Methods

  1. create
  2. updateMany
  3. updateOne
  4. get
  5. getOne
  6. deleteMany
  7. deleteOne

create

This method takes two parameters:

  1. key, this is a string
  2. value, this is an any, maybe string, number, object, array any valid data types in javascript
const memoz = new Memoz()

const person = memoz.create('name', 'john')
// {id: 'sdfd-dsfg455-dfg544fg', name: 'john'}

updateMany

This method takes two parameters:

  1. query, this is a object contains keys and values, it will be AND, this is required
  2. newData, this is an any, maybe string, number, object, array any valid data types in javascript, this is required
const memoz = new Memoz()

const person = memoz.updateMany('name', 'Milad')
// { updated: true }

updateOne

This method takes two parameters:

  1. query, this is a object contains keys and values, it will be AND, this is required
  2. newData, this is an any, maybe string, number, object, array any valid data types in javascript, this is required
const memoz = new Memoz()

const person = memoz.updateOne('name', 'Milad')
// {id: 'sdfd-dsfg455-dfg544fg', name: 'Milad'}

get

This method take one parameters:

query, this is a object contains keys and values, it will be AND, this is optional

const memoz = new Memoz()

const person = memoz.get({ name: 'Milad' })
// [{id: 'sdfd-dsfg455-dfg544fg', name: 'Milad'}]

getOne

This method take one parameters:

query, this is a object contains keys and values, it will be AND, this is required

const memoz = new Memoz()

const person = memoz.getOne({ name: 'Milad' })
// {id: 'sdfd-dsfg455-dfg544fg', name: 'Milad'}

deleteMany

This method take one parameters:

query, this is a object contains keys and values, it will be AND, this is required

const memoz = new Memoz()

const person = memoz.deleteMany({ name: 'Milad' })
// {deleted: true, number: 5}

deleteOne

This method take one parameters:

query, this is a object contains keys and values, it will be AND, this is required

const memoz = new Memoz()

const person = memoz.deleteOne({ name: 'Milad' })
// {deleted: { id: "dslkmds68-dfgh45", name: "Milad" }}
  • Engineering

    Encrypt By RSA Algorithm

    RSA is a public-key cryptosystem that is widely used for secure data transmission. It is also one of the oldest. The acronym RSA comes from the surnames of Ron Rivest.

    2 min read ↗
  • Engineering

    De Duplicated

    This is package for deleting the duplicated elements in array, there are contain two methods, first method called simpleArray, this method deduplicated the…

    4 min read ↗
  • Engineering

    Error Handler E2

    [](https://travis-ci.org/miladezzat/error-handler-e2) [](https://badge.fury.io/js/error-handler-e2) 

    2 min read ↗