Skip to content

lru get to return a copy rather than ref. Add more lru tests#177

Merged
raakella1 merged 1 commit into
eBay:stable/v8.xfrom
raakella1:lru
Sep 11, 2023
Merged

lru get to return a copy rather than ref. Add more lru tests#177
raakella1 merged 1 commit into
eBay:stable/v8.xfrom
raakella1:lru

Conversation

@raakella1

@raakella1 raakella1 commented Sep 8, 2023

Copy link
Copy Markdown
Contributor

It is not safe to return a reference of the cache entry to the caller of get in LRUCache, especially when we have a multi threaded env. We now return a copy. The caller can use T* or shared_ptr as value to optimize for object copy

@raakella1
raakella1 requested a review from szmyd September 8, 2023 22:22
szmyd

This comment was marked as outdated.

@raakella1
raakella1 requested a review from jiankyu September 11, 2023 15:40

@szmyd szmyd left a comment

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.

Explanation makes sense; 👍

@raakella1
raakella1 merged commit a424845 into eBay:stable/v8.x Sep 11, 2023
@raakella1
raakella1 deleted the lru branch September 11, 2023 16:29
szmyd added a commit that referenced this pull request Jan 10, 2024
* dump breakpad stacktrace file in the same dir as logfile (#151)

Co-authored-by: Ravi Akella email = raakella@ebay.com <raakella@sdsbuild07>

* Token Caching (#169)

* add caching to auth_manager

* fix the auth test after caching

* update folly cmake

* add build missing for all branch builds

---------

Authored-by: Ravi Akella email = raakella@ebay.com <raakella@sdsbuild07>

* add date to 3rd party (#170)

Co-authored-by: Ravi Akella email = raakella@ebay.com <raakella@sdsbuild07>

* include filesystem header in logging.h (#175)

Co-authored-by: Ravi Akella email = raakella@ebay.com <raakella@sdsbuild07>

* acquire unique lock for LRU cache get operation (#176)

Co-authored-by: Ravi Akella email = raakella@ebay.com <raakella@sdsbuild07>

* lru get to return a copy rather than ref. Add more lru tests (#177)

Co-authored-by: Ravi Akella email = raakella@ebay.com <raakella@sdsbuild07>

* disable stress test (#178)

Co-authored-by: Ravi Akella email = raakella@ebay.com <raakella@sdsbuild07>

* remove file from the map regardless of the inotify result during remove watch (#201)

Co-authored-by: Ravi Nagarjun Akella <raakella1@$HOSTNAME>

* remove -u option from conan create to fix build conflict in libcurl (#202)

Co-authored-by: Ravi Nagarjun Akella <raakella1@$HOSTNAME>

---------

Co-authored-by: raakella1 <114193113+raakella1@users.noreply.github.com>
Co-authored-by: Ravi Akella email = raakella@ebay.com <raakella@sdsbuild07>
Co-authored-by: Ravi Nagarjun Akella <raakella1@$HOSTNAME>
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