Skip to content

Added LruCache in envoy#17490

Closed
mk46 wants to merge 2 commits intoenvoyproxy:mainfrom
mk46:lru_cache
Closed

Added LruCache in envoy#17490
mk46 wants to merge 2 commits intoenvoyproxy:mainfrom
mk46:lru_cache

Conversation

@mk46
Copy link
Copy Markdown
Contributor

@mk46 mk46 commented Jul 26, 2021

Signed-off-by: Manish Kumar manish.kumar1@india.nec.com

Commit Message: Move LruCache from jwt_verify_lib/simple_lru_cache
Additional Description: This PR is follow up to comment:14341
Risk Level:
Testing: unit and build
Docs Changes: n/a
Release Notes: n/a
Fixes #16108

Signed-off-by: Manish Kumar <manish.kumar1@india.nec.com>
@mk46
Copy link
Copy Markdown
Contributor Author

mk46 commented Jul 26, 2021

CC @wrowe @htuch @qiwzhang

Signed-off-by: Manish Kumar <manish.kumar1@india.nec.com>
@tonya11en
Copy link
Copy Markdown
Member

@mk46 can you fix the formatting issues that were caught in CI? Also, can you take a look at our style guide and fix some of the deviations in lru_cache_inl.h before folks jump in?

Given that this is a pretty big change, it would also be nice to beef up the description to provide context for folks just show up (like me!).

@tonya11en
Copy link
Copy Markdown
Member

Also, why not just add https://github.com/google/jwt_verify_lib/tree/master/simple_lru_cache as an external dependency rather than copy the files?

@mk46
Copy link
Copy Markdown
Contributor Author

mk46 commented Jul 26, 2021

Also, why not just add https://github.com/google/jwt_verify_lib/tree/master/simple_lru_cache as an external dependency rather than copy the files?

As of now, this is already used as an external dependency in Jwt Cache. The purpose of adding to envoy is to consumed by other modules of envoy.

This code has a copyright of google. Please see https://github.com/google/jwt_verify_lib/blob/e5d6cf7067495b0868787e1fd1e75cef3242a840/simple_lru_cache/simple_lru_cache.h#L1

@mk46
Copy link
Copy Markdown
Contributor Author

mk46 commented Jul 26, 2021

@htuch Any thought?

@htuch
Copy link
Copy Markdown
Member

htuch commented Jul 27, 2021

I think the idea was that this might be useful beyond the JWT verifier. It seems there are a few other places that LRU might make sense (basically, whenever we're caching stuff, e.g. DNS, gRPC clients, etc.). Maybe do a quick survey and list all places LRU cache might make sense based on existing uses?

@mk46
Copy link
Copy Markdown
Contributor Author

mk46 commented Aug 2, 2021

Initially, I had tried to keep this code in envoy but as per discussion in #14341 (comment), moved Lru cache code in jwt_verify_lib.

Copy link
Copy Markdown
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

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

/wait

namespace Envoy {
namespace LruCache {

#undef GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use the = delete ; syntax to make class noncopyable without the macro.

@yanavlasov
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

please adjust coding style as well.

@@ -0,0 +1,17 @@
load(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO we can just put this in source/common/common

void operator=(const TypeName&)

// Define number of microseconds for a second.
const int64_t kSecToUsec = 1000000;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

constexpr

@mk46 mk46 closed this Aug 16, 2021
@mk46
Copy link
Copy Markdown
Contributor Author

mk46 commented Aug 16, 2021

I am closing as of now, I have been busy with some other task.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

move simple LRU cache code into envoy

8 participants