Skip to main content

redish/
lib.rs

1//! Redish - simple in-memory key-value database with TTL support
2//!
3//! # Example
4//! ```
5//! use std::time::Duration;
6//! use redish::tree::Tree;
7//! use bincode::{Decode, Encode};
8//!
9//! #[derive(Debug, Encode, Decode, Clone)]
10//! struct User {
11//!     user_id: u64,
12//!     username: String,
13//! }
14//! let user = User {user_id: 3, username: "JohnDoe2020".to_string()};
15//!
16//! let mut tree = Tree::load_with_path("/path/to/db/with_file_name");
17//! tree.put("key1".to_string().into_bytes(), "value".to_string().into_bytes());
18//! tree.put_with_ttl("key2".to_string().into_bytes(), "value".to_string().into_bytes(), Some(Duration::from_secs(60)));
19//! tree.put_typed::<User>("key3", &user);
20//! ```
21
22extern crate core;
23
24pub mod tree;
25pub mod util;
26pub mod config;
27mod logger;
28
29pub use crate::tree::{Tree, DataValue, TreeSettings, TreeSettingsBuilder};
30pub use bincode::{Decode, Encode};