New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

querymemcache

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

querymemcache

Adding an unified SQL caching functionality with memcached.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

querymemcache

querymemcache is a node.js module designed to allow you to cache the frequent queries to the DB with using of memcache. It can work with any SQL database.

Installation

Using npm:

$ npm install --save querymemcache

If you don't have or don't want to use npm:

$ cd ~/.node_modules
$ git clone git://github.com/bgrusnak/querymemcache.git

Usage

To require the library and initialize it

import QueryMemCache from 'querymemcache';
var cache=QueryMemCache({
  lifetime: 300, // cache lifetime in seconds
  servers: 'localhost:11211', // local server
    options: {
        maxKeySize: 2000  // the size of the key
    }
})

Methods

There only one method

process

Check and cache the results of queryFunction

.process({observe:observedFields, change:changedFields}, queryFunction, callbackFunction)

Parameters:

NameDescriptionTypeRequired
observeList of field names or arrays [field, operand, value] which needs to be observedArrayNo
changeList of field names or arrays [field, operand, value] which will b changedArrayNo
queryFunctionThe function, which will called if no valid data is availableFunctionYes
callbackFunctionThe function, which will receive the result of the cache processFunctionNo

Requirements

  • node.js v7.10.0+ (7.10.0 is the version I used to develop this module. I'm unsure if it will work with previous ones. If you run a previous version, and it works, let me know and I'll update this)
  • memcached 2.2.2+

Contributions

If you run into problems, have questions, or whatever else you can open an issue on this repository. If you'd like to submit a patch, shoot me a pull request. I'd like to keep this module simple, so if you want to add all kinds of crazy functionality - you might want to fork. When in doubt, send a pull request - the worst that can happen is that I won't merge it.

License

MIT © Ilya Shlyakhovoy

Keywords

memcache

FAQs

Package last updated on 22 Aug 2017

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