#sqlite #cache #persistent #local #uuid #user #serialization

pond-cache

A simple, local, persistent cache for Rust

7 releases (2 stable)

1.0.1 May 18, 2024
0.3.0 May 16, 2024
0.2.0 May 16, 2024
0.1.3 Jun 3, 2023

#897 in Encoding

Download history 11/week @ 2024-09-18 13/week @ 2024-09-25

406 downloads per month

GPL-3.0-or-later

21KB
370 lines

pond

Build Action Test Action GitHub release (latest SemVer)

Rust SQLite

Simple, local, persistent cache. Backed by SQLite

Example usage

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();
}

Dependencies

~24MB
~458K SLoC