Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 25, 2025

Adds complete support for Valkey, the open-source Redis fork, as a new key-value store implementation. This implementation provides full Redis compatibility while using the dedicated valkey-py client library.

Key Changes

New ValkeyStore Implementation

  • Complete store implementation in src/kv_store_adapter/stores/valkey/ extending BaseManagedKVStore
  • Multiple connection patterns supporting client injection, URL connections, and individual parameters:
    from kv_store_adapter import ValkeyStore
    
    # Direct parameters
    store = ValkeyStore(host="localhost", port=6379, db=0, password="secret")
    
    # URL connection  
    store = ValkeyStore(url="valkey://localhost:6379/0")
    
    # Existing client
    store = ValkeyStore(client=existing_valkey_client)

Package Integration & Lazy Loading

  • Enhanced main package exports with __getattr__ lazy loading mechanism
  • Clean import syntax for all stores: from kv_store_adapter import ValkeyStore
  • Proper dependency handling with informative error messages for missing optional dependencies
  • Updated pyproject.toml with valkey >= 6.0.0 optional dependency

Testing & Quality Assurance

  • Comprehensive test suite following existing BaseStoreTests patterns
  • Docker-based integration tests for real Valkey instance testing
  • API consistency validation ensuring all 15 public methods match expected signatures
  • Multiple initialization pattern testing covering all connection methods

Documentation Updates

  • Added Valkey store section to DEVELOPING.md alongside existing Redis documentation
  • Usage examples and configuration options matching established patterns
  • Connection options documentation for all supported initialization methods

Technical Implementation Details

The ValkeyStore implements the same Redis-compatible API patterns:

  • Uses valkey-py asyncio client for full async/await support
  • Implements compound key management for collection-based organization
  • Handles TTL operations with proper minimum value enforcement
  • Provides JSON serialization through ManagedEntry objects
  • Supports scan-based iteration for efficient large key set operations

This implementation maintains 100% API compatibility with existing store patterns while providing dedicated Valkey support as an alternative to Redis.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add valkey store support</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #8

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits September 25, 2025 02:11
Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Copilot AI changed the title [WIP] Add valkey store support Add Valkey store support with lazy loading and comprehensive integration Sep 25, 2025
Copilot AI requested a review from strawgate September 25, 2025 02:19
Copilot finished work on behalf of strawgate September 25, 2025 02:19
@strawgate strawgate closed this Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add valkey store support

2 participants