grabcli-sqlite 0.2.0

SQLite (FTS5) cache backend for grabcli
Documentation

grabcli-sqlite

crates.io docs.rs

The SQLite cache backend for grabcli: SqliteCache implements grabcli-core's Cache trait with one database (WAL, mode 0600) holding cached responses, a restaurant/menu catalog with FTS5 and trigram search, and a content-addressed image store with LRU eviction.

This is an internal building block of the grab CLI, not a general-purpose library. Its API is not stable. It is the only crate that links rusqlite.

See the root README's disclaimer.

Example

configure a cache

use grabcli_core::cache::CacheConfig;
use grabcli_sqlite::SqliteCache;

let cache = SqliteCache::new("/path/to/private/cache", CacheConfig::default());
let stats = cache.stats()?;
println!("cached responses: {}", stats.entries);
# Ok::<(), grabcli_core::Error>(())

The first operation opens or creates the database. Give each application its own private cache directory. Pass an Arc<SqliteCache> as the core Cache implementation when creating a context.

License

Apache-2.0