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

deepbase-redis

v1.1.1

Published

⚡ Fastest and simplest way to add Redis Stack persistence to your projects.

Downloads

26

Readme

🌳 DeepBase Redis

DeepBaseRedis is an innovative and efficient module designed to seamlessly integrate with Redis Stack, providing a robust solution for managing and interacting with databases. With DeepBaseRedis, you can effortlessly perform CRUD operations and manipulate data stored in Redis Stack (RedisJSON Module) keys.

For simplicity you may be interested in the version of DeepBase that persists in JSON files. https://www.npmjs.com/package/deepbase

📦 Installation

# DeepBaseRedis requires Redis Stack, which includes the necessary RedisJSON module.
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest

npm install deepbase-redis

🔧 Usage

import DeepBase from "deepbase-redis"
const mem = new DeepBase({ name: "db" }); // "db" redis prefix
await mem.connect();

✍️ Setting Values

await mem.set("config", "lang", "en");

const configLang = await mem.get("config", "lang");
console.log(configLang); // "en"

✅ Adding Rows

const path = await mem.add("user", { name: "martin" });

// add() will create a secure key (ie. "CqtOILTDUg")
console.log(path) // [ 'user', 'CqtOILTDUg' ]

const userName = await mem.get(...path, "name");
console.log(userName); // "martin"

🔢 Increment fields

await mem.inc(...path, "balance", 160);
await mem.inc(...path, "balance", 420);

const userBalance = await mem.get(...path, "balance");
console.log(userBalance); // 580

⚗️ Update

await mem.upd("config", "lang", v => v.toUpperCase());
const lang = await mem.get("config", "lang"); // EN

🔥 Finally

await mem.add("user", { name: "anya" });

const userIds = await mem.keys("user")
console.log(userIds) // [ 'CqtOILTDUg', 'MXOlTBSmEf' ]

console.log(await mem.get())
// {
//     config: { lang: 'EN' },
//     user: {
//         CqtOILTDUg: { name: 'martin', balance: 580 },
//         MXOlTBSmEf: { name: 'anya' }
//     }
// }

🤯 Features

  • 🔍 Easily access and modify nested objects in JSON storage.
  • 📁 Provides an easy-to-use interface for connecting to RedisJSON and performing data operations, saving development.
  • 🌱 Simple and intuitive API for managing complex JSON structures.

🤔 Why DeepBase

  • ⚡ Fastest and simplest way to add persistence to your projects.
  • 📖 Offers advanced querying capabilities, nested value retrieval, and seamless update processes.
  • 🧠 Easy to use and understand.

🤝 Contributing

Contributions to DeepBase are welcome! If you have an idea or a bug to report, please open an issue. If you would like to contribute to the code, please open a pull request.

🎬 Conclusion

DeepBaseRedis is built with efficiency and performance in mind, leveraging the power of the Redis Stack driver and optimizing data access operations. Whether you're building a small-scale application or a complex system, DeepBaseRedis empowers you to interact with Redis Stack effortlessly, making your development process smoother and more efficient.

🚀 Try DeepBaseRedis today and experience the convenience and power it brings to your Redis Stack data management workflow!

📄 License

The MIT License (MIT)

Copyright (c) Martin Clasen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.