Skip to content

The following python program implements a dynamic multilevel caching system with multiple cache levels using LRU or LFU eviction policies. It supports adding/removing levels, and efficiently manages data access and eviction. It ensures thread safety and handles data retrieval and insertion across levels.

Notifications You must be signed in to change notification settings

SatyamTiwari069/Dynamic_Multilevel_Cache_Management_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

///////////////////// code.py --> This program has in-built testcases in its main method. code1.0.py --> This program is menu-driven program that accepts inputs from user and provides the output according to the selected menu.

Overview: The program implements a dynamic multilevel caching system with support for multiple cache levels and eviction policies. This system is designed to efficiently manage data across various cache levels, each with its own size and eviction strategy.

Key Components:

Eviction Policies:

LRU (Least Recently Used): This policy evicts the least recently accessed item when the cache reaches its maximum size. It ensures that frequently accessed items remain in the cache. LFU (Least Frequently Used): This policy evicts the least frequently accessed item when the cache is full. It keeps items that are accessed more frequently. Cache Levels:

The system supports multiple cache levels, allowing for a hierarchical structure where data is first checked in the highest-priority cache (L1) and moves down to lower levels if not found.

Cache Operations:

addCacheLevel(size: int, evictionPolicy: str): Adds a new cache level with a specified size and eviction policy. removeCacheLevel(level: int): Removes a cache level by its index. put(key: str, value: str): Inserts a key-value pair into the highest-priority cache level (L1). get(key: str): Retrieves a value by key, moving it up to higher-priority cache levels if found in lower levels. displayCache(): Prints the current state of all cache levels, showing their contents. Thread Safety:

The system uses locks to ensure thread-safe operations, making it safe to perform concurrent reads and writes.

Summary: The program demonstrates how a multilevel caching system operates, handling data across various levels with different eviction strategies. It showcases the management of cache size, eviction of less relevant items, and the dynamic addition or removal of cache levels. This type of system is useful in scenarios where optimizing data access and storage across different layers is critical, such as in high-performance computing and web caching solutions. ///////////////////

About

The following python program implements a dynamic multilevel caching system with multiple cache levels using LRU or LFU eviction policies. It supports adding/removing levels, and efficiently manages data access and eviction. It ensures thread safety and handles data retrieval and insertion across levels.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages