cachesystemtea
v1.0.0
Published
Develop a caching module to store and retrieve data efficiently, supporting various storage backends like memory, Redis, or filesystem
Downloads
2
Readme
Cache System
A simple cache system package for Node.js applications.
Installation
Install the package via npm:
npm install @yourusername/cache-system
Usage
Import the package into your Node.js project:
const CacheSystem = require('@yourusername/cache-system');
// Create a new cache instance
const cache = new CacheSystem();
// Set a value in the cache
cache.set('key', 'value');
// Retrieve a value from the cache
const cachedValue = cache.get('key');
console.log(cachedValue); // Output: 'value'
// Remove a value from the cache
cache.remove('key');
// Clear the entire cache
cache.clear();
API
set(key, value, expiresIn)
Sets a value in the cache with an optional expiration time.
key
(string): The key to store the value under.value
(any): The value to store in the cache.expiresIn
(number): Optional. The time in milliseconds until the cached item expires.
get(key)
Retrieves a value from the cache.
key
(string): The key of the value to retrieve.
remove(key)
Removes a value from the cache.
key
(string): The key of the value to remove.
clear()
Clears the entire cache.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.#� �C�a�c�h�e�S�y�s�t�e�m�T�e�a� � �#� �c�a�c�h�e�s�y�s�t�e�m�t�e�a� � �