Features
- Fast and efficient key-value storage
- Support for expiration of keys
- Disk and in-memory database support
- Synchronous API for better performance and concurrency
- Built on top of Deno's SQLite module for robust SQLite operations
- Pattern-based key retrieval
Usage
Example Usage
// Import the library
import MiftahDB from "https://deno.land/x/miftahdb/mod.ts";
// Create a new disk-based database instance
const db = new MiftahDB("database.db");
// Or create an in-memory database
const memDB = new MiftahDB(":memory:");
// Use the database
db.set("user:1234", { name: "Ahmad Aburob" });
const user = db.get("user:1234");
console.log(user);
Running Your Code
Since this library depends on the unstable FFI API, you must pass the following flags when running your code:
--allow-env
--allow-ffi
--unstable-ffi
Network and FS permissions are also needed to download and cache the prebuilt library. You can use the --allow-all
or -A
flag to grant all necessary permissions, as FFI gives full access.
deno run -A --unstable-ffi <file>