Socket
Book a DemoInstallSign in
Socket

obj-cache

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obj-cache

object cache for nodejs

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

cache

Object cache for nodejs.

Getting Started

npm install obj-cache

API

var cache_object=new cache(

{ name:'cache name', //optional keepalive:5601000, //optional,defalt 5 min loader:function(key,callback){}, dispose:function(value){} //optional });

cache_object.get(key,callback)

cache_object.try_get(key)

cache_object.exists(key)

cache_object.remove(key)

cache_object.clear()

cache_object.length

cache_object.dispose()

cache.cleanup()

cache.get_cache(name)

Sample


var cache=require('obj-cache');
var mycache=new cache(
	'mycache',
	1000*30,
	function(key,callback)
	{
		database.connect(
			key,
			function(err,conn)
			{
				callback(err,conn);	
			}
			);
	},
	function(conn)
	{
		conn.close();
	}
);

...

mycache.get(
	'database connection string',
	function(err,conn)
	{
		conn.query(....);

	}
	);

....

//exiting application
cache.cleanup(); //release resource in all caches

Keywords

cache

FAQs

Package last updated on 24 Jan 2013

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.