Skip to content

RR cache #6307

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 12 commits into
base: master
Choose a base branch
from
Open

RR cache #6307

wants to merge 12 commits into from

Conversation

KevinMwita7
Copy link

  • 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

@KevinMwita7 KevinMwita7 changed the title Rr cache RR cache Jun 20, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 97.76119% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.34%. Comparing base (a8ad162) to head (2be52bb).

Files with missing lines Patch % Lines
...m/thealgorithms/datastructures/caches/RRCache.java 97.76% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6307      +/-   ##
============================================
+ Coverage     74.17%   74.34%   +0.16%     
- Complexity     5362     5391      +29     
============================================
  Files           678      679       +1     
  Lines         18686    18820     +134     
  Branches       3625     3646      +21     
============================================
+ Hits          13860    13991     +131     
- Misses         4272     4273       +1     
- Partials        554      556       +2     

☔ 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.

# Conflicts:
#	src/test/java/com/thealgorithms/datastructures/caches/RRCacheTest.java
@KevinMwita7 KevinMwita7 marked this pull request as ready for review June 20, 2025 21:43
@KevinMwita7
Copy link
Author

@DenizAltunkapan I have added EvictionStrategy<K, V> which contains the method onAccess(RRCache<K, V> cache) that determines to either run evictExpired() periodically (if get() or size() has been called n times) or on each call. I think PeriodicEvictionStrategy is a better approach as it balances performance and memory usage.

@KevinMwita7
Copy link
Author

Also infer action is failing

@DenizAltunkapan
Copy link
Collaborator

Also infer action is failing

@KevinMwita7 yup, that's not your fault. all good

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.

3 participants