feat(cache): implement MemoryCache with DashMap - #413
Open
Opulencechuks wants to merge 1 commit into
Open
Conversation
Contributor
|
@Opulencechuks fix the conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #404
Description
This PR introduces a fast, thread-safe, and concurrent in-memory caching solution to support high-frequency, low-latency data access. It resolves the need for a non-blocking cache by replacing standard
Mutex-wrapped maps with a lock-free structure, significantly improving parallel read and write performance.How It Was Done
CacheProvidertrait and implemented it for a newMemoryCachestruct located incrates/core/src/cache/memory.rs.dashmapcrate as the underlying storage mechanism to handle high-throughput concurrent access without introducing significant lock contention.Arc(Atomic Reference Counting) to prevent unnecessary and expensive cloning when reading from the cache.Issues Encountered (If Any)
No significant roadblocks were encountered. The
dashmapcrate perfectly fit the requirements for lock-free parallel data structures out-of-the-box. (Note: Local compilation issues such as the MSVC/Windows SDKkernel32.liberror are environment-specific and do not affect the validity of the codebase).Related Issue
Closes #404
How It Was Tested
Eq + Hash + Clone) and verified that theMemoryCachecleanly mapsCacheProvidermethods (get,insert,remove,clear) to the underlyingdashmapimplementation.Screenshots / Video (If Applicable)
N/A (This is a backend infrastructure change with no UI modifications).