https://github.com/ajlekcahdp4/lfuda-cpp
implementation of the LFU-DA caching strategy on C++
https://github.com/ajlekcahdp4/lfuda-cpp
cache cpp lfuda
Last synced: 2 months ago
JSON representation
implementation of the LFU-DA caching strategy on C++
- Host: GitHub
- URL: https://github.com/ajlekcahdp4/lfuda-cpp
- Owner: ajlekcahdp4
- Created: 2022-07-25T06:20:33.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-10T12:13:41.000Z (almost 3 years ago)
- Last Synced: 2025-02-09T15:46:58.368Z (4 months ago)
- Topics: cache, cpp, lfuda
- Language: C++
- Homepage:
- Size: 14.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LFUDA cache implementation on C++
## table of contents
1. [about](#about)
2. [How to](#how-to-build)
3. [details](#details)
## about
In this repository I implemented LFU-DA (least frequently used with dynamic aging) page replacement policy. And compare this policy with ideal cache replacement policy - Belady's (See the result of this comparision on random tests [there](test/compared.txt)).
## How to build
Linux
```
cmake -S ./ -B build/ -DCMAKE_BUILD_TYPE=Release
cd build/
make
```
## How to run tests
```
cd build/
ctest
```
## How to compare number of hits of lfuda and belady (ideal cache)
```
cd test
./compare.sh
```
## details
### review
LFU-DA policy similar to the classic LFU except that cache stores his age and the weight of new cache members is set to this age, not to 1 (as in LFU). As in the LFU when needs to insert new element in cache we evict the element with the lowest weight. In other words, LFU-DA combines LFU and LRU policies.### Complexity of the lookup_update () function:
ln(N) on average, worst case N * ln(N),
where N - cache capacity.