amnesia

Crates.ioamnesia
lib.rsamnesia
version0.1.5
sourcesrc
created_at2023-12-14 21:41:27.363462
updated_at2023-12-15 12:06:53.692025
descriptionAn expressive interface for interacting with a Cache.
homepage
repositoryhttps://github.com/m1guelpf/amnesia
max_upload_size
id1070178
size26,637
Miguel Piedrafita (m1guelpf)

documentation

README

Amnesia

An expressive Rust library for interacting with a Cache.

crates.io download count badge docs.rs

Features

  • Driver-Based Architecture: Easily switch between different caching strategies by using drivers.
  • Asynchronous API: Built with async/await for non-blocking I/O operations.
  • Serialization: Leverage Serde for serializing and deserializing cache values.
  • Time-to-Live (TTL): Set expiration times for cache entries to ensure stale data is not served.
  • Extensible: Implement your own cache drivers to extend functionality.

Usage

let mut cache = Cache::<RedisDriver>::new(RedisConfig { // or DynamoDBDriver, DatabaseDriver, MemoryDriver, etc.
    redis_url: "..."
}).await?;

let my_value = cache.remember("test-value", Duration::from_secs(10), my_value).await?;

cache.forget("test-value").await?;

Please refer to the documentation on docs.rs for detailed usage instructions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 9

cargo fmt