Use the app: https://cache-evictions-simulator.netlify.app/
Simulate 4 different cache eviction policies (FIFO, LRU, MRU and Clock) in a linked-list implementation of a fully associative cache.
- What is a cache? A cache is a temporary, small storage space for data to be quickly accessed. It's usually used to store frequently used or important information to avoid taking a long time to obtain from longer-term memory.
- What does it mean to be "fully associative"? This means that data can be stored in any unused block in a cache.
- Backend: Java, Spring Boot
- Frontend: React.js, JavaScript, CSS
- Deployment: Render (using a Dockerfile) for the backend and Netlify for the frontend
- Data Structures: Linked List
- If cache is empty, insert the element
- If element is not in the cache, and the size of cache has not been reached, append new value
- If element is not in the cache, and the size of cache has been reached, delete the first element and append the new element
- If cache is empty, insert the element
- If element is not in the cache, and the size of cache has not been reached, append new value
- If element is already in the cache, and the size of cache has not been reached, then move the first element to the back
- If element is not in the cache, and the size of cache has been reached, delete the first element and append the new element
- If cache is empty, insert the element
- If element is already in the cache, then set its reference bit
- If element is not in the cache and the size of cache has been reached, continually unset the reference bit and move the clock pointer until the reference bit is no longer 1. Then, overwrite element at the clock pointer and move clock pointer again
- If element is not in the cache and the size of cache has not been reached, append element to cache
- If cache is empty, insert the element
- If element is not in the cache, and the size of the cache has not been reached, append new value
- If element is already in the cache, and the size of cache has not been reached, then move the first occurrence of the element to the back
- If element is not in the cache, and the size of cache has been reached, delete the last element and append the new element
Use the web app: https://cache-evictions-simulator.netlify.app/
Disclaimer:
- Sometimes, the request/response between the frontend and server takes some time, so when creating the cache or adding to the cache, there may be a delay of up to a minute.
- Also, while we have tried our best to ensure that the cache policies yield accurate results, there is always the chance of incorrect cache orderings or discrepancies.