Skip to content

Start evicting elements from the DNS memory cache#9583

Open
swankjesse wants to merge 3 commits into
masterfrom
jwilson.0723.memory_cache
Open

Start evicting elements from the DNS memory cache#9583
swankjesse wants to merge 3 commits into
masterfrom
jwilson.0723.memory_cache

Conversation

@swankjesse

Copy link
Copy Markdown
Collaborator

No description provided.


/**
* This cache is configured with a target [maxSize], but it will not evict entries until it
* has twice as many entries.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also considered evicting whenever we were 25% greater than the target. Both 1.25x and 2x have the same big-O runtime. 1.25x is better on memory, 2.x is better on CPU.

*
* This evicts in big batches because each eviction must traverse the entire cache.
*/
abstract class MemoryCache<K : Any, V : Any>(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a way to mark global changes that would invalidate the whole cache?

Let's say the default network changes, we should not used cached values.

I think for network selection we can have different caches. So it's mainly for global changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants