npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dinache

v0.1.0

Published

Restful light weight in-memory cache server built on top of node.js and dinoloop.

Downloads

14

Readme

npm version downloads Known Vulnerabilities

Dinache

Dinache is an open source RESTFUL light weight in-memory cache server built on top of node.js and dinoloop.

Why Dinache?

You can quickly setup a cache server via HTTP endpoint by installing a npm package. HTTP and JSON format are supported across variety of programming languages. Nodejs is known for handling millions of concurrent requests with less memory and Javascript objects are key-value pairs which makes Nodejs a perfect choice to build light weight in-memory cache server.

Prerequisites

  • Node 8.10.x or higher

Install

npm install dinache

Quickstart

Step 1: Add app.ts (file: app.ts)

import { Dinache } from 'dinache';

// Checks for process.env.PORT and if not found, starts in-memory cache server on default 8080 port.
new Dinache().start();

// Checks for process.env.PORT and if not found, starts in-memory cache server on provided 4200 port.
new Dinache(4200).start();

Step 2: Open your Postman (make a POST request to http://localhost:8080/query")

  • GET key
// GET key
{
    query: {
        op: 'GET',
        key: 'key1'
    }
}
// result
{
    query: {
        value: 'YOU_WILL_GET_VALUE'
    }
}
  • PUT key
// PUT key
{
    query: {
        op: 'PUT',
        key: 'key1',
        value: 'value1'
    }
}
// result
{
    query: { }
}
// or you receive the following error when you try to put a key which already exists.
{
    query: {
        error: 'KEY_EXISTS'
    }
}
  • DELETE key
// DELETE key
{
    query: {
        op: 'DELETE',
        key: 'key1'
    }
}
// result is similar when you try to delete a key that exists or not.
{
    query: { }
}
  • UPSERT key
// UPSERT key
{
    query: {
        op: 'UPSERT',
        key: 'key1',
        value: 'value1'
    }
}
// result is similar when you try to upsert a key that exists or not.
{
    query: { }
}
  • UPDATE key
// UPDATE key
{
    query: {
        op: 'UPDATE',
        key: 'key1',
        value: 'value1'
    }
}
// result
{
    query: { }
}
// or you receive the following error when you try to update a key which dont exists.
{
    query: {
        error: 'KEY_NOT_EXISTS'
    }
}
  • Possible values for op are GET | PUT | UPDATE | UPSERT | DELETE.
  • Use UPSERT if you want to update or create.
  • Use PUT if you want to create when key not exists.

Batch queries (make a POST request to http://localhost:8080/query")

You can also execute batch queries instead of making subsequent calls to server and reduce round-trips.

// batch-queries
{
    batch: [{
        op: 'GET',
        key: 'key1'
    }, {
        op: 'PUT'
        key: 'key2',
        value: 'value2
    }, {
        op: 'PUT'
        key: 'key2',
        value: 'value2
    }]
}
// result
{
    batch: [{
        value: 'value1'
    }, {

    },{
        error: 'KEY_EXISTS'
    }]
}

License

MIT Licensed.