pickledb 0.1.0

A lightweight and simple key-value store written in Rust, heavily inspired by [Python's PickleDB](https://pythonhosted.org/pickleDB/)
Documentation

PickleDB

Build Status Crate API

PickleDB is a lightweight and simple key-value store written in Rust, heavily inspired by Python's PickleDB

PickleDB is fun and easy to use

use pickledb::PickleDb;

fn main() {
    
    // create a new DB with AutoDum, meaning every change is written to the file
    let mut db = PickleDb::new("example.db", PickleDbDumpPolicy::AutoDump);
    
    // set the value 100 to the key 'key1'
    db.set("key1", &100);
    
    // print the value of key1
    println!("The value of key1 is: {}", db.get::<i32>("key1").unwrap());

    // load the DB from the same file
    let db2 = PickleDb::load("example.db", PickleDbDumpPolicy::DumpUponRequest).unwrap();

    // print the value of key1
    println!("The value of key1 as loaded from file is: {}", db2.get::<i32>("key1").unwrap());
}

Installation

This crate works with Cargo and can be found in crates.io Add this to your Cargo.toml:

[dependencies]
pickledb = "*"

Documentation

All documentation for this crate can be found in docs.rs

Examples

There are currently two examples shipped with PickleDB:

  • Hello World which shows the basic usage of PickleDB: create a new DB, load a DB from file, get/set key-value pairs of different types, and more
  • Lists which shows how to use lists in PickleDB: create new lists, add/remove items from lists, retrieve items from lists, remove lists, and more