Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
jsredisorm
Advanced tools
Readme
jsRedisORM is a Node.js library that provides an Object-Relational Mapping (ORM) interface for interacting with Redis 4.6.7. It simplifies the process of working with Redis as a cache or a data store in your Node.js applications.
You can install jsRedisORM using npm:
npm install jsredisorm
To use jsRedisORM in your project, import the createClient function from the Redis library and the jsRedisORM class from the jredis-orm package:
import { createClient } from "redis";
import jsRedisORM from "jsRedisORM.js";
Create an instance of the jsRedisORM class by providing the required Redis connection details:
const redis = new jsRedisORM(
host,
port,
(username = null),
(password = null),
(tlsOptions = null),
(dbIndex = 0),
(keyPrefix = "")
);
Before interacting with Redis, you need to establish a connection. Use the connect method to connect to the Redis server:
await redis.connect();
###Caching Data NodeRedisORM provides methods to set, get, and delete key-value pairs, lists, sets, hashes, and more. Here are some examples:
// Set a value in Redis
await redis.set("key", "value");
// Get a value from Redis
const value = await redis.get("key");
// Delete a key from Redis
await redis.delete("key");
To disconnect from the Redis server, you can use the quit method:
await redis.quit();
The following methods are available in the jsRedisORM class:
connect(): Connects to the Redis server.
set(key, value, expiration): Sets a value for the specified key in Redis.
get(key): Retrieves the value for the specified key from Redis.
delete(key): Deletes the specified key from Redis.
setList(key, values, expiration): Sets a list of values for the specified key in Redis.
getList(key): Retrieves the list of values for the specified key from Redis.
deleteList(key): Deletes the list associated with the specified key from Redis.
setSet(key, values, expiration): Sets a set of values for the specified key in Redis.
getSet(key): Retrieves the set of values for the specified key from Redis.
deleteSet(key): Deletes the set associated with the specified key from Redis.
setHash(key, values, expiration): Sets a hash of key-value pairs for the specified key in Redis.
getHash(key): Retrieves the hash of key-value pairs for the specified key from Redis.
deleteHash(key): Deletes the hash associated with the specified key from Redis.
Contributions to jsRedisORM are welcome! If you find any bugs or have suggestions for improvements, please feel free to open an issue or submit a pull request.
FAQs
jsRedisORM is a Node.js library that provides an Object-Relational Mapping (ORM) interface for interacting with Redis. It simplifies the process of working with Redis as a cache or a data store in your Node.js applications.
The npm package jsredisorm receives a total of 0 weekly downloads. As such, jsredisorm popularity was classified as not popular.
We found that jsredisorm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.