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

querymemcache

v0.1.2

Published

Adding an unified SQL caching functionality with memcached.

Downloads

2

Readme

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:

Name | Description | Type | Required | -----|------------ |------|:----------:| observe| List of field names or arrays [field, operand, value] which needs to be observed | Array | No | change| List of field names or arrays [field, operand, value] which will b changed | Array | No | queryFunction | The function, which will called if no valid data is available| Function |Yes| callbackFunction | The function, which will receive the result of the cache process| Function |No|

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