🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

kasza-js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kasza-js

Kasza.js is simple Cache service/helper/tool for your App

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Kasza.js

Kasza.js is simple Cache service/helper/tool for your App.

Getting Started

Prerequisites

This package is using UMD pattern, so it means that you can use it:

  • in Node.js project
  • browser running project
    • without AMD
    • with AMD

Installation

Option A: With npm

npm install kasza-js

Option B: Download

Download version that fits your better:

Compressed version - 1.44KB

Uncompressed version - 2.41KB

And simply add HTML tag:

<script type="text/javascript" src="kasza.min.js"></script>

Usage

Basic set and get

// set value 'kiszony' for id 'ogorek'
Kasza.set('ogorek', 'kiszony');

// get value for id 'ogorek'
Kasza.get('ogorek'); // will return 'kiszony'

What's special about it? Well, you can use it as storage between files. Example:

In file1.js:

import Kasza

var commonData = {
  key: value,
  fn: function() {
    return true;
  }
};

Kasza.set('common data', commonData);

In file2.js:

import Kasza

var commonData = Kasza.get('commmon data');

Use TTL (Time To Live)

In file1.js:

import Kasza

var temporaryData = [1, 2, 3];

// set TTL to 1 minute (60,000ms)
Kasza.set('tmp data', temporaryData, 60000);

In file2.js:

import Kasza

var temporaryData = Kasza.get('tmp data'); // will return proper data

setTimeout(function() {
  temporaryData = Kasza.get('tmp data'); // will return undefined
}, 60001);

Use Debug

Enable/Disable Debug
Kasza.setup({
  // by default it's false
  debug: true
});
Use custom debug function
Kasza.setup({
  debug: function(msg) {
    // do something with msg
  }
})

TODO

  • save Cache in IndexedDB (if user wishes to)

FAQ

  • Why "Kasza"? What does it mean? How should I even pronounce it?!

    Kasza is Polish word and means groats, kasha. According to Wiktionary it's pronounced /ˈka.ʂa/.

    Why? Well - because for kasza for me sounds simmilar to cache. That's all 😊

Authors

  • Marek Sierociński - Initial work - marverix

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

cache

FAQs

Package last updated on 16 May 2018

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