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

Merged
merged 6 commits into from
Jul 5, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve removeKey
  • Loading branch information
KevinMwita7 committed Jul 4, 2025
commit cd4a4f3cfb3e832dd00028bf1d18fa8b57212900
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ public void put(K key, V value, long ttlMillis) {
* Removes all expired entries from the cache.
*
* <p>This method iterates through the list of cached keys and checks each associated
* entry for expiration. Expired entries are removed from both the key tracking list
* and the cache map. For each eviction, the eviction listener is notified.
* entry for expiration. Expired entries are removed the cache map. For each eviction,
* the eviction listener is notified.
*/
private int evictExpired() {
int count = 0;
Expand All @@ -223,18 +223,17 @@ private int evictExpired() {
/**
* Removes the specified key and its associated entry from the cache.
*
* <p>This method deletes the key from both the cache map and the key tracking list.
*
* @param key the key to remove from the cache
* @param key the key to remove from the cache;
* @return the value associated with the key; or {@code null} if no such key exists
*/
public V removeKey(K key) {
if (key == null) {
throw new IllegalArgumentException("Key cannot be null");
}
CacheEntry<V> entry = cache.remove(key);

// No such key in cache
if (entry == null) {
notifyEviction(key, null);
return null;
}

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy