How t3j45-r41/adaptive_cache_redis works
This repository is a stock-quote caching and comparative eviction-policy study, with a Redis-compatible C++ server, a Python API and MySQL persistence, and a React monitoring dashboard. The main workflow is dashboard or experiment requests through the API to the cache and relational data, with quote ingestion and workload generation supporting evaluation. The tree and excerpts show the API, cache, and persistence boundaries; benchmark execution internals and some subsystem wiring are not fully shown, so those links are omitted or documented at a high level.
Main entry points: App.tsx Dashboard App · main.py FastAPI App · connection.py Relational Database · db_service.py Database Queries
Components 28
Cache Server
- Server Startup
Redis-Server/src/main.cpp - RESP TCP Server
Redis-Server/src/RedisServer.cpp - Command Handler
Redis-Server/src/RedisCommandHandler.cpp - Cache Operations
Redis-Server/src/RedisDatabase.cpp - Eviction Policies
Redis-Server/eviction/AdaptiveEvictionPolicy.cpp
Market Data
- Relational Database
python/database/connection.py - Quote Ingestion
python/ingestion/stock_ingestion.py - Workload Generation
python/workload/workload_generator.py - Analytics Plots
python/analytics/analytics_plots.py
API and Analytics
- FastAPI App
backend/app/main.py - Dashboard Routes
backend/routes/dashboard.py - Cache Routes
backend/routes/cache.py - Experiment Routes
backend/routes/experiments.py - Analytics Routes
backend/routes/analytics.py - Stock Routes
backend/routes/stocks.py - Database Queries
backend/services/db_service.py - Redis Client
backend/services/redis_service.py
Monitoring Dashboard
- Dashboard App
frontend/src/App.tsx - API Client
frontend/src/services/api.ts - Overview and Comparisons
frontend/src/components/OverviewSection.tsx - Adaptive Monitoring
frontend/src/components/AdaptiveMonitoringSection.tsx - Benchmark Controls
frontend/src/components/BenchmarkControlSection.tsx - DBMS Analytics
frontend/src/components/DBMSAnalyticsSection.tsx - Stock Market View
frontend/src/components/StockMarketSection.tsx
Other components
- Dashboard User
- MySQL Service
- Yahoo Finance
- Benchmark Client
Connections 33
- Dashboard User → Dashboard App: uses
- Dashboard App → API Client: requests data
frontend/src/App.tsx - Dashboard App → Overview and Comparisons: renders
frontend/src/App.tsx - Dashboard App → Adaptive Monitoring: renders
frontend/src/App.tsx - Dashboard App → Benchmark Controls: renders
frontend/src/App.tsx - Dashboard App → DBMS Analytics: renders
frontend/src/App.tsx - Dashboard App → Stock Market View: renders
frontend/src/App.tsx - API Client → FastAPI App: calls REST
frontend/src/services/api.ts - FastAPI App → Dashboard Routes: registers
backend/app/main.py - FastAPI App → Cache Routes: registers
backend/app/main.py - FastAPI App → Experiment Routes: registers
backend/app/main.py - FastAPI App → Analytics Routes: registers
backend/app/main.py - FastAPI App → Stock Routes: registers
backend/app/main.py - Dashboard Routes → Redis Client: reads cache
backend/routes/dashboard.py - Dashboard Routes → Database Queries: queries metrics
backend/routes/dashboard.py - Cache Routes → Redis Client: controls cache
backend/routes/cache.py - Experiment Routes → Database Queries: stores results
backend/routes/experiments.py - Analytics Routes → Database Queries: queries metrics
backend/routes/analytics.py - Stock Routes → Database Queries: reads quotes
backend/routes/stocks.py - Stock Routes → Redis Client: checks cache
backend/routes/stocks.py - Database Queries → Relational Database: executes queries
backend/services/db_service.py - Relational Database → MySQL Service: connects to
python/database/connection.py - Quote Ingestion → Relational Database: stores quotes
python/ingestion/stock_ingestion.py - Yahoo Finance → Quote Ingestion: provides quotes
- Workload Generation → Relational Database: loads market data
python/workload/workload_generator.py - Benchmark Client → RESP TCP Server: sends RESP2
- Server Startup → RESP TCP Server: starts
Redis-Server/src/main.cpp - Server Startup → Cache Operations: configures and restores
Redis-Server/src/main.cpp - RESP TCP Server → Command Handler: dispatches commands
- Command Handler → Cache Operations: executes commands
Redis-Server/src/RedisCommandHandler.cpp - Cache Operations → Eviction Policies: updates policy
Redis-Server/src/RedisDatabase.cpp - Redis Client → RESP TCP Server: sends RESP commands
backend/services/redis_service.py - Analytics Plots → Relational Database: uses persisted data