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

cache-master

v1.0.3

Published

Cache manager for application using various storage medium.

Downloads

11

Readme

Cache-Master


Cache master is a cache manager for your application through various storage medium ( currently supports only localStorage in browsers).

Features

  • Simple to Use API's.
  • Uses Axios which is supported by most of the browsers.
  • Cleaner to maintain the clean the storage.

Getting the cache-master

npm install cache-master

or

yarn add cache-master

Including cache-master

import cachemaster from 'cache-master' //ES6
or
let cachemaster = require('cache-master')

or include the compiles js directly in the html file

<script src="/node_modules/cache-master/dist/bundle.js"/>

Using cache-master

let cm = new CacheMaster(/*ConfigObject[optional]*/);
cm.fetch( '/news' /* ID */ , 24 /* in seconds */ ,{
	method:'GET',
	url:'https://api.themoviedrug.com/api/v1'
}).then({cache,trigger,fromCache}){
	/* do something with cache */
	doSomething(cache)
	fromCache || trigget.then(daata=>{
		doSomething(freshData);
	});

});

Syntax

fetch( id , ttl , axiosObject, forceFetch /* Boolean */);

id is the key for cache. It should start with a /. Example /movies/234 ttl is the time to live (ttl) in seconds . axiosObject is the fetching axios Object. Refer axios forceFetch says whether to fetch even though cache is available. Default is true

Response from Cache-Master

Cache master response consist of {cache,trigger,fromCache} cache object consist of cached result or actual result after fetching fromCache shows whether results are from cache or fetched fresh trigger is a promise for new fetch.

Short Hand methods

Cache master also provides some short hand methods to simplify the fetching process.

cm.get('/news',24,'urlToFetch',data)
cm.post('/news',24,'urlTochtch',data);