Skip to content

Conversation

@Rishav9852Kumar
Copy link
Contributor

@Rishav9852Kumar Rishav9852Kumar commented May 12, 2025

Description

Currently, our system only allows for the invalidation of the entire user authentication cache, which can lead to numerous cache misses and inefficiencies. This change is required to allow for more precise cache management, specifically targeting stale cache entries at the individual user level without disrupting the cache state of other users

Adding my changes on top of prev contributors 4571 [changes in progress]

Category: New feature
Why these changes are required?
Currently, our system only allows for the invalidation of the entire user authentication cache. This change is required to allow for more precise cache management, specifically targeting stale cache entries at the individual user level without disrupting the cache state of other users.
What is the old behavior before changes and new behavior after changes?
Previously, invalidating a user's cache required clearing the entire cache, affecting all users. The new behavior introduces an endpoint that allows for the invalidation of cache entries on a per-user basis, thereby maintaining cache integrity for other users and reducing unnecessary cache misses.

Issues Resolved

[List any issues this PR will resolve]

2829

Testing

Unit testing was written in FlushCacheApiTest.java

Check List

  • [ x] New functionality includes testing
  • New functionality has been documented
  • New Roles/Permissions have a corresponding security dashboards plugin PR
  • API changes companion pull request created
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

dlin2028 and others added 12 commits July 16, 2024 07:38
Signed-off-by: David Lin <dlin2028@gmail.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Prabhas Kurapati <prabhask@berkeley.edu>
Signed-off-by: David Lin <dlin2028@gmail.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Prabhas Kurapati <prabhask@berkeley.edu>
Signed-off-by: Prabhas Kurapati <prabhask@berkeley.edu>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
@shikharj05
Copy link
Collaborator

Thanks @Rishav9852Kumar! can you add some testing details?


requestHandlersBuilder.allMethodsNotImplemented().override(Method.DELETE, (channel, request, client) -> {
final ConfigUpdateRequest configUpdateRequest;
if (request.path().contains("/user/")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems to be patch API where more than 1 user can be updatec new Route(Method.PATCH, "/internalusers"). How will this work then?

Copy link
Member

Choose a reason for hiding this comment

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

To follow convention, this should use legacy as well as current paths: /user and /internalusers. What are the expected paths here? Also, this should be documented.

@nagarajg17 PATCH api should not be on concern as it doesn't aim to remove user entries correct?

Copy link
Contributor Author

@Rishav9852Kumar Rishav9852Kumar May 16, 2025

Choose a reason for hiding this comment

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

PATCH api should not be on concern as it doesn't aim to remove user entries correct?

Yes

public ActionRequestValidationException validate() {
if (configTypes == null || configTypes.length == 0) {
return new ActionRequestValidationException();
} else if (configTypes.length > 1 && (entityNames != null && entityNames.length > 1)) {
Copy link
Member

Choose a reason for hiding this comment

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

is this to check that if entityNames are supplied then only type of entity, i.e. ConfigType is supplied? This will need to be documented. Also, this behavior opens it for other config-types as well, to allow passing of entityNames.


requestHandlersBuilder.allMethodsNotImplemented().override(Method.DELETE, (channel, request, client) -> {
final ConfigUpdateRequest configUpdateRequest;
if (request.path().contains("/user/")) {
Copy link
Member

Choose a reason for hiding this comment

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

To follow convention, this should use legacy as well as current paths: /user and /internalusers. What are the expected paths here? Also, this should be documented.

@nagarajg17 PATCH api should not be on concern as it doesn't aim to remove user entries correct?

@Rishav9852Kumar
Copy link
Contributor Author

#5337

@Rishav9852Kumar Rishav9852Kumar deleted the rk-flush-user-cache branch May 19, 2025 05:38
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.

8 participants