Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧩 Blockchain Node Cache

A three-layer cache system designed for blockchain node environments

📌 Project Overview

blockchain-node-cache is a three-tier cache system implemented in Rust, designed for use within blockchain node infrastructures.

The cache is structured into three hierarchical layers:

Local → Global → Database

Each layer represents a staged key-value state:

  • Local Layer – Temporary, request-scoped cache
  • Global Layer – Shared in-memory cache
  • Database Layer – Persistent storage backend

🔁 Commit & Rollback Model

  • When a layer commits, its state is propagated upward.
  • When a layer rolls back, modified key-value pairs are discarded.
  • This design enables controlled state propagation and transactional-style cache behavior.

🏗 Architecture Design

The system is implemented with a generic database abstraction.

Through a trait-based interface, the database backend is defined as a generic type parameter, allowing integration with any storage engine as long as it satisfies the required trait contract.

This ensures:

  • Database-agnostic design
  • Flexible backend replacement
  • Strong type safety via Rust generics

The trait module defines the core cache interface contract.


📂 Repository Structure

src/
├─ cache/
│  ├─ db.rs
│  ├─ global.rs
│  ├─ local.rs
│  └─ mod.rs
├─ lib.rs
└─ trait.rs
cache/

Contains the layered cache implementation:

local.rs – Local cache layer logic

global.rs – Global shared cache layer

db.rs – Database layer integration

mod.rs – Cache module wiring

trait.rs

Defines the core cache interface and database abstraction contract.

lib.rs

Library entry point.

🛠 Tech Stack

Language: Rust

Concurrency Map: scc::HashMap

Architecture: Layered Cache System (Local → Global → DB)

Design Pattern: Trait-based Generic Abstraction

⚙️ Key Features

Three-layer hierarchical cache

Commit & rollback propagation model

Generic database abstraction

Pluggable storage backend

Concurrent-safe in-memory cache (via scc)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages