v1.8
An optimized key-value storage based on sqlite.
Repository
Current version released
2 years ago
Dependencies
deno.land/x
fast_storage
An optimized key-value storage based on sqlite.
How to use
import { LocalStorage, storage } from "https://deno.land/x/fast_storage/mod.ts";
//INSERT
await storage.set("some_key", { param1: "value1" });
//this is different from (key is not object path!):
await storage.set("some_key.param1", "value1");
//GET
const res = await storage.get("some_key");
//DELETE
const res = await storage.delete("some_key2");
//GET LIST (You can define namespaces, for example: "contacts.phone1", "contacts.phone2").
await storage.set("contacts.phone1", "574937586");
await storage.set("contacts.phone2", "214837483");
const contacts = await storage.getList("contacts."); //return "contacts.phone1" and "contacts.phone2"
//GET RANGE
const users = await storage.getRange("1", "1000"); //returns all users where the key is between (including) 1 and 1000. The `star`t and `end` parameters are optional, but at least one must exist. Analogously, there is the `deleteRange` method.
//The `getList` and `getRange` methods have an optional last parameter `getKey=false`.
//DELETE LIST
await storage.deleteList("shop1.");
The variable storage is an instance of LocalStorage with: path=”./fast_storage.sqlite”, tableName = “LOCAL_STORAGE”.
About
Author: Henrique Emanoel Viana, a Brazilian computer scientist, enthusiast of web technologies, cel: +55 (41) 99999-4664. URL: https://sites.google.com/site/henriqueemanoelviana
Improvements and suggestions are welcome!