Skip to content

agge3/cache-manager

Repository files navigation

Cache Manager

Concurrent LRU cache with O(logn) sorted index. Single-threaded implementation with initial design documentation is included in single.


Description

The expected outcomes of cache-manager are to reimplement data structures and methods of the C++ STL and Java SE API. Those "from scratch" implementations will be used to implement a ground-up database LRU cache with O(logn) sorted index.


Tech Stack


Key Components

Concurrent cache-manager:

  • LRU Cache Core:
    Implements least-recently-used eviction policy with atomic synchronization and TBB concurrent data structures.

Single-threaded cache-manager implements hand-rolled data structures (hashmap, SLL, DLL)


Dependencies

Dependency Minimum Version Notes
Podman Latest stable For containerized build & test
C++ Compiler C++20-compliant GCC ≥ 10.2 or Clang ≥ 12 recommended
CMake 3.14 – 3.28 For project configuration
Intel TBB Used for concurrent containers
GTest / GMock Unit testing framework

Organization

On branch concurrency

include

  • cache-manager.hpp - CacheManager template header and implementation.

  • test-runner.hpp - Handrolled threaded test runner with benchmark metrics.

  • macros.hpp - Utility macros.

  • list

    • concurrent-list.hpp - ConcurrentList interface and specializations.
    • concurrent-list-impl.hpp - ConcurrentList interface concrete implementation.
    • coarse-concurrent-list-impl.hpp - CoarseConcurrentList implementation. (WARNING: has races).
    • fine-concurrent-list-impl.hpp - FineConcurrentList implementation (WARNING: has races).

src

  • main.cpp - Main driver and test runner.

single - Single-threaded CacheManager.

  • include

    • singly-linked-list.hpp - SinglyLinkedList share header.
    • doubly-linked-list.hpp - DoublyLinkedList share header.
    • hash-map.hpp - HashMap share header.
    • cache-manager.hpp - CacheManager share header.
    • test - Hand-rolled test suite (not GTest).
    • impl - Template implementations.
      • singly-linked-list-impl.hpp - SinglyLinkedList template implementation.
      • doubly-linked-list-impl.hpp - DoublyLinkedList template implementation.
      • hash-map.hpp-impl - HashMap template implementation.
      • cache-manager-impl.hpp - CacheManager template implementation.
  • src

    • main.cpp - Main driver with GTest test cases, to run CacheManager and all test suites.
    • test.cpp - Hand-rolled test suite (not GTest) implementation.
  • doc - Class and sequence diagrams, and Doxygen build target.

  • config - Project configuration files (e.g., Doxyfile).

  • tools - Utility tools and scripts (bash).

  • external - External libraries and resources.

    • lib
    • milestoneX - Milestone JSON configuration (for main driver test cases).

Running

Run script assumes podman. See run-podman.sh for specific Docker run configuration (NOTE: there's no specifics).

./run-podman.sh

Building

Build uses CMake.

Linux

mkdir build
cd build
cmake ../
make all

# to run test suite
./cache-manager

Visual Studio

Install CMake plugin.


Credit

Inspirations

Reference for LRU cache:


Authors

@agge3
@kpowkitty

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages