A smart, typed Redis client that auto-detects object types and serializes them safely.
Project description
redis-flex
A lightweight, flexible, and developer-friendly wrapper around Redis that simplifies common cache operations while keeping your code clean, fast, and maintainable.
redis-flex provides:
🔥 Simple get/set API
🧠 Automatic JSON serialization/deserialization
⏱️ Built-in TTL support
🧩 Optional namespacing
🚀 Zero-config fast setup
📝 Type-hint friendly design
Perfect for Python backend applications, microservices, FastAPI/Django projects, or any system that needs blazing-fast caching with Redis.
📦 Installation pip install redis-flex
🚀 Quick Start from redis_flex import RedisFlex
Initialize client
cache = RedisFlex(host="localhost", port=6379, db=0)
Set a value
cache.set("user:1", {"name": "Nishant", "role": "developer"}, ttl=300)
Get the value back (auto JSON decoded!)
user = cache.get("user:1") print(user)
🧠 Features ✔ Simple API cache.set("key", "value") cache.get("key")
✔ Auto JSON support cache.set("profile", {"name": "Nishant"}) profile = cache.get("profile") # returns dict
✔ Namespacing
Useful for multi-tenant apps:
cache_ns = RedisFlex(namespace="app1") cache_ns.set("token", "abcd")
Internally stored as: app1:token
✔ TTL (Expiry) cache.set("otp", 1234, ttl=60)
✔ Delete key cache.delete("user:1")
⚙️ Initialization Options RedisFlex( host="localhost", port=6379, db=0, password=None, namespace=None, decode_responses=True )
🔧 API Reference set(key, value, ttl=None)
Stores data in Redis. Auto-converts Python objects to JSON.
get(key)
Fetches data. Auto-deserializes JSON back to Python types.
delete(key)
Deletes the key.
📁 Project Structure redis_flex/ init.py redis_flex.py README.md pyproject.toml LICENSE
🛠️ Contributing
Pull requests are welcome! If you're making major changes, please open an issue first to discuss what you'd like to change.
📜 License
This project is licensed under the MIT License.
⭐ Support
If you find redis-flex useful, give it a star on GitHub and help others discover it!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redis_flex-0.2.2.tar.gz.
File metadata
- Download URL: redis_flex-0.2.2.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d2a440145ac75a41434a8f95db2aec41a7c1bdf96d2b0598c7870236cbfb44f
|
|
| MD5 |
d287d80011946a27101990b37b98b1c2
|
|
| BLAKE2b-256 |
20adc0adafe79ebf046f52a4b5359a90f2ccffe1c476c83948d2598fa4d86792
|
File details
Details for the file redis_flex-0.2.2-py3-none-any.whl.
File metadata
- Download URL: redis_flex-0.2.2-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed908b77b32516e9065bd8fb9d3d1c180175b33782ebee79a035fc6d86ad2284
|
|
| MD5 |
0786d6896b2835fdaa9b63429703524e
|
|
| BLAKE2b-256 |
bb72710dee0f0245b01f7ffcaf322b5fa1e4e37842297e5f7cca580567f7cc02
|