Socket
Book a DemoInstallSign in
Socket

arida-cache

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arida-cache

a library for your client cache.

0.0.3
latest
Source
npmnpm
Version published
Weekly downloads
4
100%
Maintainers
1
Weekly downloads
 
Created
Source

Introduction

A libabry for caching your client data

Install

npm install arida-cache

Usage example

(function testInit() {
	function funcs() {
		this.aaaa = function() {
			console.log('a is runing');
		}
		this.b = function() {
			console.log('b is runing');
		}
	}
	const funcsInstance = new funcs();
	cache.init(funcsInstance.aaaa, 5, funcsInstance, 'aaaa');
	funcsInstance.aaaa({a: 1});
	console.log(cache.get());
	setTimeout(() => {
		funcsInstance.aaaa({a: 1});
		console.log(cache.get());
	}, 6000);
	
})()

Run the example above, you will get result below:

a is runing
post
{ ca1a41f90da606b052ecf10c8286817813bc8861: { a: 1 } }
pre
a is runing
post
{ ca1a41f90da606b052ecf10c8286817813bc8861: { a: 1 } }

API

The following is an incomplete list of arida API. It should give you a general concept of arida's usage.

  • .init: function(funcs, duration, context, funcName): config the cache
    funcs: present the func will be hooked
    duration: set the cache's duration
    context: should be assign if not in window or global
    funcName: must be assign otherwise not anyoumous
  • .get(): Returns cache;

Contributing

We welcome all contributions, please submit any ideas as pull requests or as a GitHub issue.

Licence

MIT

Keywords

client-cache

FAQs

Package last updated on 01 Apr 2016

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.