Giter Site home page Giter Site logo

cache-component's Introduction

S2 (Simple Storage component)

Description

Purpose

Main goal of this component is to provide simple possibility to store and retrieve Key:Value pairs.

How works

Under the hood used MongoDB. During Action configuration collection need to be specified.

Requirements

Instance of MongoDB with possibility to connect from component.

Environment variables

No.

Credentials

hostname - Hostname or IP address of MongoDB server.

port - Port which is used by your MongoDB server to accept connection. (Default is 27017)

db - Database name that is used to store collections with Key:Values

user - MongoDB username with access to read and write from/to corresponding DB and collection.

pass - Password for specified user.

Actions

Store

Inserts Key:Value pair.

Input fields:

keyName - Name of a field where key will be stored

key - Value of a key that uniquely identifies Key:Value pair

valueName - Name of a field where value will be stored

value - Value that will be stored and can be accessed with provided keyName and key

If checkbox "Update if exists?" checked then value would be updated if already exists.

Resulting document stored in MongoDb will have following structure:

{
    keyName: key,
    valueName: value
}

If another valueName will be stored with the same keyName:key it will be added to existing document and result will be:

{
    keyName: key,
    valueName: value,
    valueName1: value1
}

Result will be:

  • If there where no such keyName:key yet:
{
  "response": "inserted"
}
  • If keyName:key already exists but doesn't have valueName provided:
{
  "response": "updated"
}
  • If such keyName:key and valueName combination already exists and checkbox "Update if exists?" checked:
{
 "response": "updated"
}
  • If such keyName:key and valueName combination already exists and checkbox "Update if exists?" not checked:
{
 "response": "skipped"
}

Store Batch

Inserts Key:Value pair array.

Input fields:

keyName - Name of a field where key will be stored

valueName - Name of a field where value will be stored

keyValArray - Array with values

Each value in array is object which have following fields:

keyValue - Value of a key that uniquely identifies Key:Value pair

value - Value that will be stored and can be accessed with provided keyName

Request example:

{
    keyName: "someKeyName",
    valueName: "someValueName",
    keyValArray: [
        {
            keyValue : "someKeyValue1",
            value: "someValue1"
        },
        {
            keyValue : "someKeyValue2",
            value: "someValue2"
        }
    ]
}

All provided Key:Vale pairs will be inserted, if key already exist it will be replaced.

Response:

{
  "response": "done"
}

Retrieve

Returns value by provided key and Value name if found or provided default value.

Input fields:

keyName - Name of a field where key is stored

key - Value of a key that uniquely identifies Key:Value pair

In response document from MongoDB collection will be provided, e.g.:

{
    keyName: keyValue,
    valueName: value,
    valueName1: value1
}

Retrieve Batch

Returns array of values by provided key array.

Input fields:

keyName - Name of a field where key stored

keyArray - Array of keyValues

Response format is following:

{
  "response": [
    {
      keyName1: key1,
      valueName1: value1
    },
    {
        keyName2: key2,
        valueName2: value2
    }
  ]
}

Remove

Removes Value provided in valueName or all values for specified key if "Delete all values for this key?" checkbox checked.

Input fields:

keyName - Name of a field where key stored

key - Value of a key that uniquely identifies Key:Value pair

valueName - Name of a field that should be deleted

Response format is following:

{
  "result": "done"
}

cache-component's People

Contributors

kirill-levitskiy avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.