Skip to main content

Redis Tools plugin for Fastpluggy

Project description

Redis Tools for FastPluggy

Redis Tools Version

A powerful Redis browser and management plugin for FastPluggy applications. This plugin provides a user-friendly interface to browse, search, and manage Redis databases and keys.

Features

  • Redis Browser UI: Intuitive web interface to browse and manage Redis data
  • Multi-Database Support: Switch between Redis databases easily
  • Key Management: View, search, and delete Redis keys
  • Data Type Support: Full support for all Redis data types (string, list, hash, set, zset)
  • Pickled Data Handling: Automatic detection and unpickling of Python pickled data
  • TTL Management: View time-to-live for keys
  • Database Flushing: Clear entire databases with confirmation
  • Scheduled Cleanup: Optional scheduled task to clean expired keys (requires tasks_worker plugin)

Installation

  1. Install the official plugin package:
pip install fastpluggy-plugins

or

pip install fastpluggy-plugin-redis
  1. Add the plugin to your FastPluggy application:

There are several ways to add the plugin to your FastPluggy application:

Method 1: Using the Admin Interface

  1. Navigate to /admin/plugins in your FastPluggy application
  2. Click on "Install New Plugin"
  3. Enter "redis_tools" as the plugin name
  4. Click "Install"

Method 2: Using the Configuration File

Add the plugin to your FastPluggy configuration file:

# config.py
FASTPLUGGY_PLUGINS = [
    # other plugins...
    "redis_tools",
]

Method 3: Programmatically

Add the plugin programmatically in your application code:

from fastapi import FastAPI
from fastpluggy import FastPluggy

app = FastAPI()
pluggy = FastPluggy(app)

# Add the Redis Tools plugin
pluggy.add_plugin("redis_tools")

For more detailed installation and configuration instructions, see the Installation Guide.

Configuration

Configure Redis Tools through environment variables or directly in your FastPluggy configuration:

Setting Description Default
REDIS_DSN Redis connection string (overrides other connection settings if provided) None
redis_host Redis server hostname localhost
redis_port Redis server port 6379
redis_db Default Redis database index 0
use_ssl Whether to use SSL for Redis connection False
redis_password Redis server password None
redis_decode_responses Whether to decode Redis responses False
keys_limit Maximum number of keys to display 100

Usage

Web Interface

Once installed, access the Redis browser at /redis_tools/ in your FastPluggy application. The interface allows you to:

  1. Select and switch between Redis databases
  2. Search for keys using patterns (e.g., user:*)
  3. View key details including type, TTL, and size
  4. Examine and format key values based on their data type
  5. Delete individual keys
  6. Flush entire databases

Programmatic Usage

You can also use the Redis Tools connector in your code:

from redis_tools.redis_connector import RedisConnection

# Create a connection
redis_conn = RedisConnection()

# Test connection
if redis_conn.test_connection():
    # Get all keys matching a pattern
    keys = redis_conn.get_keys("user:*")

    # Get details for a specific key
    key_details = redis_conn.get_key_details("user:1001")

    # Switch to another database
    redis_conn.select_db(2)

    # Delete a key
    redis_conn.delete_key("temporary_key")

Development

Requirements

  • Python 3.10+
  • FastPluggy
  • Redis

Testing

Run tests with pytest:

cd redis_tools
pip install -r tests/requirements.txt
pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

fastpluggy_redis-0.0.19.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

fastpluggy_redis-0.0.19-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file fastpluggy_redis-0.0.19.tar.gz.

File metadata

  • Download URL: fastpluggy_redis-0.0.19.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for fastpluggy_redis-0.0.19.tar.gz
Algorithm Hash digest
SHA256 01052487faa5fcab53b54e74a9f2fbb311023eb6a24acb08d03c34e7e9d251d8
MD5 28d551d8161573aacc3f44fa30b5de6f
BLAKE2b-256 0c1ea8b79a8a65efb5efc82b5d0ff1f862b7a9a4f606cfe11c00b6825cc1d0e6

See more details on using hashes here.

File details

Details for the file fastpluggy_redis-0.0.19-py3-none-any.whl.

File metadata

File hashes

Hashes for fastpluggy_redis-0.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 c0b24a84df6e98131e72dbe5ef53ca2a424df66b693d73c9eb3971434900d15b
MD5 3eec32e0cd23cac6a39360e8d36f3a9d
BLAKE2b-256 20d7d81add59a5f186c4fab64706d4a7f75279daa0507051f181fa64fa4725d9

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