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 🙏

© 2026 – Pkg Stats / Ryan Hefner

memento-mysql

v1.0.2

Published

MySQL query caching for node.js

Downloads

7

Readme

Memento - MySQL query caching for Node.js
------------------------------------------------------

>> About

Memento is a MySQL query caching module for Node.js. 
Memento uses memcached to improve Node.js applications 
performance.

>> Quick benchmarks

The following queries were ran against one table with
100 000 rows of random data. These are the execution
times to return all rows from each query:

"SELECT * FROM test WHERE id>10000 LIMIT 1"

	Without Memento : 0.023 seconds
	With Memento : 0.011 seconds	

"SELECT * FROM test WHERE id>10000 LIMIT 250"

	Without Memento : 0.027 seconds
	With Memento : 0.012 seconds	

"SELECT * FROM test WHERE id>10000 LIMIT 1000"

	Without Memento : 0.033 seconds
	With Memento : 0.014 seconds	

"SELECT * FROM test WHERE id>10000 LIMIT 2500"

	Without Memento : 0.042 seconds
	With Memento : 0.018 seconds	

"SELECT * FROM test WHERE id>10000 LIMIT 5000"

	Without Memento : 0.063 seconds
	With Memento : 0.025 seconds	

>> Required modules

Memento needs the following modules to run:

node-mysql (https://github.com/felixge/node-mysql)

node-memcached (https://github.com/3rd-Eden/memcached)

>> Installation

	$ npm install memento-mysql
	
>> Usage

Query usage is very similar to node.js mysql module;

	var Memento = require('memento-mysql');

	var mysqlConfig = {
		host     : 'localhost',
		user     : 'root',
		password : '',
		database : 'test'
	};

	var memcachedConfig = "127.0.0.1:11211";

	var memento = new Memento({
		mysql: mysqlConfig, 
		memcached: memcachedConfig
	});

	memento.query('SELECT * FROM test LIMIT 1', 
		function(err, rows, fields) {
			if (err) throw err;

			console.log(rows);
			
			memento.finish();
		}
	);
	
Memento needs to be initialized with both the MySQL
connection configuration object and the Memcached 
connection configuration object. Both these objects
are the same you would normally pass to the MySQL module
and the Memcached module.

The queries are cached for 5 minutes (300 seconds) by
default. You can change the timeout value in seconds
by changing	the cacheTimeout variables;

	memento.cacheTimeout = 900; // 15 minutes

Once you are done with Memento, you need to call the
finish() method to clean up the connections.

------------------------------------------------------
https://github.com/maxlabelle/Memento