Timeline for Thread safe accessing memory cache using semaphore
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 3, 2023 at 21:14 | answer | added | Prolog | timeline score: 0 | |
| Oct 30, 2023 at 11:37 | comment | added | Prolog |
I'm aware that MemoryCache is thread-safe. I'm more concerned about thread-safety of the token obtaining process, so other threads do not interfere meanwhile.
|
|
| Oct 30, 2023 at 8:24 | comment | added | iSR5 |
if you're using MemoryCache then there is no need for SemaphoreSlim as MemoryCache is thread-safe. You could check its implementation to verify that. However, if you're expecting a custom implementation that you're afraid is not a thread-safe, then your approach would be feasible.
|
|
| Oct 26, 2023 at 1:26 | answer | added | ChrisWue | timeline score: 2 | |
| Oct 25, 2023 at 14:11 | comment | added | Peter Csala | As an alternative approach: Have a background worker which runs in every 3-4 minutes. The worker issues the request to obtain the new token. Whenever it receives the token it overwrite the cache value. | |
| Oct 25, 2023 at 13:47 | history | edited | Peter Csala | CC BY-SA 4.0 |
added 2 characters in body; edited tags
|
| Oct 25, 2023 at 11:53 | history | asked | Prolog | CC BY-SA 4.0 |