Add cache with FIFO replacement policy by KevinMwita7 · Pull Request #6337 · TheAlgorithms/Java · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Add cache with FIFO replacement policy #6337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

KevinMwita7
Copy link
Contributor

@KevinMwita7 KevinMwita7 commented Jul 3, 2025

Description

This PR adds a reusable FIFOCache implementation with the following features:

  • Fixed size FIFO eviction policy using LinkedHashMap
  • Time to live (TTL)
  • Thread-safe operations using ReentrantLock
  • Pluggable EvictionStrategy to control expired entry cleanup
  • Eviction listener callback support for observing removals
  • Hit and miss statistics tracking
  • Builder for flexible configuration

Checklist

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2025

Codecov Report

Attention: Patch coverage is 94.52055% with 8 lines in your changes missing coverage. Please review.

Project coverage is 74.48%. Comparing base (712ada5) to head (cd4a4f3).

Files with missing lines Patch % Lines
...thealgorithms/datastructures/caches/FIFOCache.java 94.52% 2 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6337      +/-   ##
============================================
+ Coverage     74.33%   74.48%   +0.15%     
- Complexity     5392     5423      +31     
============================================
  Files           679      680       +1     
  Lines         18820    18966     +146     
  Branches       3646     3670      +24     
============================================
+ Hits          13990    14127     +137     
- Misses         4274     4276       +2     
- Partials        556      563       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KevinMwita7 KevinMwita7 marked this pull request as ready for review July 3, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.