Giter Site home page Giter Site logo

amit-077 / node-cachify Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 10 KB

node-cachify is a simple Node.js caching tool designed to enhance performance by efficiently storing and retrieving data using key-value pairs with an optional time to live (TTL) feature.

JavaScript 100.00%

node-cachify's Introduction

node-cachify

node-cachify is a simple Node.js caching tool designed to enhance performance by efficiently storing and retrieving data using key-value pairs with an optional time to live (TTL) feature.

Installation

npm install node-cachify

Usage

const Cache = require('node-cachify');

const cache = new Cache();     // Create a new instance of Cache

cache.set('key1', 'value1', 60);   // Set values in the cache with a TTL of 60 seconds

console.log(cache.get('key1'));   // Get values from the cache

// Output: value1

Functions

set

Sets a key-value pair with a optional TTL field (in seconds). Returns true on success.

cache.set('key1', 'value1', 60);

get

Retrieves the value associated with the specified key from the cache. Returns null if not found in cache.

let val = cache.get("key1");
console.log(val);

// Output : value1

delete

Removes the key-value pair associated with the specified key from the cache.

let deleteData = cache.delete('key1');
console.log(deleteData);   // returns true on successful deletion

// Output: true

clear

Clears the entire cache.

cache.clear()

node-cachify's People

Contributors

amit-077 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.