Crates.io | pond-cache |
lib.rs | pond-cache |
version | 1.0.1 |
source | src |
created_at | 2023-06-03 19:21:05.201284 |
updated_at | 2024-05-18 17:13:08.859172 |
description | A simple, local, persistent cache for Rust |
homepage | |
repository | https://github.com/mrivnak/pond |
max_upload_size | |
id | 881805 |
size | 58,387 |
Simple, local, persistent cache. Backed by SQLite
use std::path::PathBuf;
use uuid::Uuid;
use pond_cache::Cache;
#[derive(Clone, serde::Serialize, serde::Deserialize)]
struct User {
pub first_name: String,
pub last_name: String,
}
fn main() {
let cache = Cache::new(PathBuf::from("./db.sqlite")).unwrap();
let user_id = Uuid::new_v4();
let user = User {
first_name: "John",
last_name: "Doe",
};
cache.store(&user_id, user).unwrap();
let result: Option<User> = cache.get(&key).unwrap();
}