Skip to main content

Crate azcache

Crate azcache 

Source
Expand description

§azcache

Unified cache backend for Redis and Memcached.

This crate provides a common interface for interacting with different cache backends, allowing you to switch between implementations without changing your application code.

§Example

use azcache::{CacheBackend, CacheError, CacheResult};

struct MyCache;

impl CacheBackend for MyCache {
    fn get(&self, key: &str) -> CacheResult<Option<Vec<u8>>> {
        // Your implementation here
        Ok(None)
    }

    fn set(&self, key: &str, value: &[u8], ttl_seconds: Option<u64>) -> CacheResult<()> {
        // Your implementation here
        Ok(())
    }

    fn delete(&self, key: &str) -> CacheResult<bool> {
        // Your implementation here
        Ok(false)
    }

    fn exists(&self, key: &str) -> CacheResult<bool> {
        // Your implementation here
        Ok(false)
    }
}

Enums§

CacheError
Error type for cache operations.

Traits§

CacheBackend
Trait defining the interface for cache backends.

Type Aliases§

CacheResult
Result type for cache operations.