Skip to content

Valkeyriee/Valkeyrie-py

Repository files navigation

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

About

The pip install for valkeyrie using pypi.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors