Skip to main content

A lightweight Redis-compatible Python client for Valkeyrie distributed cache

Project description

Valkeyrie Python Client

A lightweight, Redis-compatible Python client for Valkeyrie distributed cache system.

Installation

pip install valkeyrie

Quick Start

from valkeyrie import ValkeyreClient

# Connect to Valkeyrie server
with ValkeyreClient('localhost', 6379) as client:
    # SET and GET
    client.set('user:1001', 'Alice')
    value = client.get('user:1001')
    print(value)  # 'Alice'
    
    # Check existence
    if client.exists('user:1001'):
        print("Key exists!")
    
    # Set expiration (TTL)
    client.expire('user:1001', 300)  # 5 minutes
    
    # Delete key
    client.delete('user:1001')

Features

  • ✅ Full RESP protocol support
  • ✅ Context manager for automatic connection handling
  • ✅ Simple, intuitive API
  • ✅ Compatible with Redis commands
  • ✅ No external dependencies
  • ✅ Python 3.7+

API Reference

Connection

client = ValkeyreClient(host='127.0.0.1', port=6379)
client.connect()
client.disconnect()

Commands

Method Description
set(key, value) Set key to value
get(key) Get value by key
delete(key) Delete key
exists(key) Check if key exists
expire(key, seconds) Set expiration time
keys() Get all keys
info() Get cache statistics
ping() Test connection

Example

from valkeyrie import ValkeyreClient

client = ValkeyreClient('localhost', 6379)
client.connect()

# Store user session
client.set('session:abc123', 'user_data')
client.expire('session:abc123', 3600)

# Retrieve session
session = client.get('session:abc123')

# Get all keys
all_keys = client.keys()

# Get cache stats
stats = client.info()
print(stats)

client.disconnect()

Requirements

  • Python 3.7+
  • Running Valkeyrie server

License

MIT License

Links

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

valkeyrie-1.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

valkeyrie-1.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file valkeyrie-1.0.1.tar.gz.

File metadata

  • Download URL: valkeyrie-1.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for valkeyrie-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3c1868641175cbcf1e7b0f16ef5b2674c29ebd44659cc540691fee769c441e5c
MD5 66bcef56a6bc424ce747746c6109fd99
BLAKE2b-256 81c9b7dacb5d708a45c226fde9a522c01964226f06a7a96d22115ab0033ef914

See more details on using hashes here.

File details

Details for the file valkeyrie-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: valkeyrie-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for valkeyrie-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2547dc39a57d9a61fee303e1745160aad442526993f58d30d9b04e618eaa3bd0
MD5 6d4182b1c7a60167a3843adca7a7aa5b
BLAKE2b-256 705d157710ac7863c56aebb06879299ee6995d5861c91eab4089533c16a7879d

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