Skip to content

Implement CacheProvider Trait #402

Description

@codeZe-us

The project requires a unified interface for various caching mechanisms to ensure they can be used interchangeably throughout the codebase. The CacheProvider trait will define the standard contract for storing, retrieving, and evicting data, allowing seamless substitution between memory, disk, and Wasm-specific implementations without altering the consuming logic.

Implementation guidelines

  • Define the core CacheProvider async trait with get, put, remove, and clear methods.
  • Ensure the trait is object-safe or uses generics appropriately for key and value types, bounding them with Send, Sync, Serialize, and Deserialize.
  • Include standard error handling definitions for cache misses, capacity limits, and serialization/deserialization failures.

Files location

crates/core/src/cache/provider.rs

Expected result

A robust, reusable trait that abstracts away the underlying storage mechanism, enabling flexible and modular caching solutions across the system.

Please make sure to use the PR template when submitting your pull request.

Join the contributor Telegram group and ask any questions: https://t.me/+sII7WPhll2liMGNk

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions