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

memcache-ppp

v0.5.2

Published

Memcache for node

Downloads

713

Readme

Memcache Plus Plus Plus

Memcache Plus Plus Plus - Bettererer Memcache module for Node js. Forked from the memcache-pp module, which was forked from memcache-plus, so you can find many refs to the memcache-plus in the docs or code itself.

What's new in "Plus Plus Plus" over "Plus Plus" and the original "Plus"?

  • Removed hashring and replaced it with a simple cycle through each host
  • Fixed uncaught exception errors when retrieving certain data values
  • Support multiline/empty string/values where the data is a keyword (such as END) properly
  • Added missing touch/gat/gats commands
  • getMulti/gatMulti send one one command to request all keys at once instead of a loop of many requests
  • Fixed potential race condition when using 2+ hosts requesting the same key at the same time

Use unix sockets (33% faster than TCP)

Edit your /etc/memcached.conf and comment out / add lines such as:

# -p 11211
# -l 127.0.0.1
-s /var/run/memcached/memcached.sock
-a 777

Then use in your code with:

import MemcachePlus from 'memcache-ppp';
const memcache = new MemcachePlus({ "hosts": ["/var/run/memcached/memcached.sock:0"] });

Use Gets/Cas

const [value, cas] = await memcache.gets('key');
if (!await memcache.cas('key', 'newvalue', cas)) {
  // value changed between our gets() and cas() calls
}

Touch and Gat/Gats

memcache.touch(key, ttl);
memcache.gat(key, ttl, opts);
memcache.gats(key, ttl, opts);

Why remove hashring?

  • Many people use only a single server on localhost, or a unix socket, making it pointless anyway
  • It is CPU intensive to calculate a MD5 hash of every key for every operation
  • Hashring's internal cache grows up to several GB of RAM in less than a day

What makes it "Plus"?

  • Native support for Promises or Callbacks
  • Elasticache auto discovery baked in
  • Actively developed and used
  • Focus on cleanliness and simplicity
  • Command buffering - start issuing commands right away, memcache-plus will automatically wait until connected then flush that buffer
  • Ability to disable with just a flag on init - sounds trivial, but nice to test with memcache off without altering any of your code
  • Compression built in on a per item basis
  • ~~Cached retrieve (coming soon!) - simply pass a function for retrieving a value and a key and memcache-plus will do the whole "check key, if it exists return it, if not run the function to retrieve it, set the value, and return it" for you~~
  • ~~Support for binaries (coming soon!) which the other memcache libraries for Node don't support~~
  • (these things are not coming here)