Skip to content

update value type to any#2

Merged
lushenle merged 2 commits intomasterfrom
update-value-type
Dec 2, 2025
Merged

update value type to any#2
lushenle merged 2 commits intomasterfrom
update-value-type

Conversation

@lushenle
Copy link
Copy Markdown
Owner

@lushenle lushenle commented Dec 2, 2025

This pull request introduces support for storing and retrieving values of any type (not just strings) in the cache, refactors the client and server code to handle generic types, and adds new documentation and configuration examples for deployment, architecture, monitoring, and Raft integration. Additionally, it improves metrics reporting for cache memory usage and enhances the startup configuration and health endpoints. Below are the most important changes grouped by theme.

Core cache and API changes:

  • Changed the cache value type from string to any in pkg/cache/cache.go, and updated all relevant cache methods (Set, Get, handleExpiredKey) to support generic values. [1] [2] [3] [4]
  • Updated the gRPC API and client code to use protobuf Any for value serialization/deserialization, enabling support for arbitrary types. This includes changes to pkg/client/client.go and the OpenAPI/Swagger spec. [1] [2] [3] [4]

Configuration and startup improvements:

  • Added a sample configuration file (config.example.yaml) and refactored startup logic in pkg/cmd/main.go to load configuration, support hot reload, and configure Raft for distributed mode. Health and readiness endpoints were also added. [1] [2] [3] [4] [5] [6]

Metrics and monitoring enhancements:

  • Improved cache memory usage metrics to accurately estimate the size of values of any type, using reflection for unsupported types in pkg/cache/metrics.go. [1] [2] [3]
  • Added documentation for monitoring metrics, including cache and Raft metrics, in docs/monitoring.md.

Documentation updates:

  • Added detailed documentation for system architecture (docs/architecture.md), deployment (docs/deployment.md), Raft integration (docs/raft.md), and code quality report (docs/quality_report.md). [1] [2] [3] [4]

Testing and benchmarking:

  • Added new cache benchmark tests in bench/benchmark_test.go to measure Set and Get performance.

@lushenle lushenle merged commit 45ad77a into master Dec 2, 2025
2 checks passed
@lushenle lushenle deleted the update-value-type branch December 2, 2025 14:57
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.

1 participant