question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to keep cache isolated between different users ?

See original GitHub issue

Let us consider the following method

@Cacheable()
  getOrders() {
    return this.http
    .get(`${environment.api}/orders`);
  }

If I switch users in the same machine in the same window (like logout and login). I see that the cache from the previous user is used for the currently logged-in user. which yields me totally wrong set of values.

I also tried to set the globalCacheKey to be a unique id to isolate the cache between multiple users. But it doesn’t work.

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
angelnikolovcommented, Aug 11, 2021

Hey @fasidOnGit, I think this should be left to user land since we cant make any assumptions on when and how to clear the cache. The global cache key is just for the purposes of name-spacing your cache storage.

0reactions
fasidOnGitcommented, Aug 12, 2021

Alright, thanks for the explanation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FairRide: Near-Optimal, Fair Cache Sharing | the morning paper
Isolation – each user should receive no less cache space than they would if the cache were statically and equally divided between all...
Read more >
Caching guidance - Azure Architecture Center | Microsoft Learn
Learn how caching can improve the performance and scalability of a system by copying frequently accessed data to fast storage close to the...
Read more >
FairRide: Near-Optimal, Fair Cache Sharing - People @EECS
performance isolation for multiple users/applications and high utilization for the systems. We study the problem of fair allocation of memory cache for ...
Read more >
Improve security and privacy by updating HTTP Cache
There are often multiple layers of cache. Some caches are dedicated to a single user, some to multiple users. Some are controlled by...
Read more >
9 Understanding Caching - Oracle Help Center
EclipseLink uses two types of cache: the shared persistence unit cache (L2) maintains objects retrieved from and written to the data source; and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found