Skip to main content

A lightweight in-memory cache inspired by Redis (educational)

Project description

Rapid Redis

Rapid Redis is a lightweight, educational in-memory cache library inspired by Redis. It is built entirely in Python for learning purposes and designed to be simple, minimal, and easy to extend.


Overview

Rapid Redis provides a basic Redis-like interface for storing and managing cached data using Python dictionaries under the hood. It currently supports five common data structures and exposes simple, intuitive methods for cache operations.


Features

  • In-memory key-value cache using Python dictionaries

  • Basic operations: set, get, delete, exists, and flush

  • Supports multiple data structures:

    • Strings
    • Lists
    • Sets
    • Hashes
    • Sorted Sets
  • Easy to use and lightweight — ideal for understanding Redis fundamentals


Installation

You can install Rapid Redis locally using:

pip install -e .

(Ensure you run this from the project root directory where setup.py is located.)


Usage

from rapid_redis import RapidCache
from rapid_redis.datastructures import strings, lists, sets, hashes, sortedsets

cache = RapidCache()

# String operations
cache.set("name", "Atharsh")
print(cache.get("name"))  # Output: Atharsh

# List operations
lists.lpush(cache, "mylist", 1, 2, 3)
print(cache.get("mylist"))  # Output: [3, 2, 1]

# Set operations
sets.sadd(cache, "myset", "a", "b", "c")
print(sets.smembers(cache, "myset"))  # Output: {'a', 'b', 'c'}

# Hash operations
hashes.hset(cache, "user:1", "name", "Atharsh")
print(hashes.hget(cache, "user:1", "name"))  # Output: Atharsh

# Sorted set operations
sortedsets.zadd(cache, "scores", 10, "Alice")
sortedsets.zadd(cache, "scores", 5, "Bob")
print(sortedsets.zrange(cache, "scores", 0, -1))  # Output: ['Bob', 'Alice']

Roadmap

Planned features for upcoming releases include:

  • TTL (Time-to-Live) support for expiring keys
  • Persistent cache storage (saving data to disk)
  • Thread-safe operations
  • Command-line interface for quick cache access
  • Optional lightweight server mode for experimentation
  • Concurrency for multiple user handling

Contributing

Rapid Redis is an open project — contributions are welcome. If you’d like to improve functionality, add features, or clean up code, feel free to fork the repository and open a pull request.


License

This project is released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rapid_redis-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rapid_redis-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file rapid_redis-0.1.1.tar.gz.

File metadata

  • Download URL: rapid_redis-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rapid_redis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3ce74555d1bf1daed2fb0ccd18c1b85b66d65028861bf376fb6a57767b2f0209
MD5 f5c22a78ebd65f2c7b76ac720e1ac9ab
BLAKE2b-256 a999d58085680455b30c7c72082ca8ea7eea8bcca660ba50ecf94e1bf5122257

See more details on using hashes here.

File details

Details for the file rapid_redis-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: rapid_redis-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rapid_redis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 337aaf990678be4fb6b68130d13b7c4519b977059456987e2ead66cb60318558
MD5 2c4e5d812f8b55b51f868816c3380183
BLAKE2b-256 72ad6e8527d2d9a82ce12c8a4ac05e8de135ad7351f0212409174b81d55e1f1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page