armature-cache

Crates.ioarmature-cache
lib.rsarmature-cache
version0.1.1
created_at2025-12-27 00:35:04.811185+00
updated_at2025-12-30 22:27:31.501367+00
descriptionCache management for Armature framework with Redis and in-memory support
homepagehttps://pegasusheavy.github.io/armature
repositoryhttps://github.com/pegasusheavy/armature
max_upload_size
id2006491
size125,217
Joseph R. Quinn (quinnjr)

documentation

README

armature-cache

Cache management for the Armature framework.

Features

  • Multiple Backends - Redis, in-memory, and custom stores
  • TTL Support - Automatic expiration
  • Async API - Non-blocking cache operations
  • Serialization - Automatic JSON serialization/deserialization
  • Connection Pooling - Efficient Redis connections via bb8

Installation

[dependencies]
armature-cache = "0.1"

Quick Start

use armature_cache::{Cache, RedisCache};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Connect to Redis
    let cache = RedisCache::new("redis://localhost:6379").await?;

    // Set a value with TTL
    cache.set("key", "value", Some(Duration::from_secs(300))).await?;

    // Get a value
    let value: Option<String> = cache.get("key").await?;

    // Delete a value
    cache.delete("key").await?;

    Ok(())
}

Backends

Redis

let cache = RedisCache::new("redis://localhost:6379").await?;

In-Memory

let cache = MemoryCache::new();

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt