You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We used EFCoreSecondLevelCacheInterceptor on a single web server for months without problems. We wanted to scale out by adding more servers and one Redis Sentinel. We quickly recognized problems with records added on one server missing on the others.
We used EFCoreSecondLevelCacheInterceptor on a single web server for months without problems. We wanted to scale out by adding more servers and one Redis Sentinel. We quickly recognized problems with records added on one server missing on the others.
We analyzed possible causes and found
that ClearAllCachedEntries is called unexpectedly https://github.com/VahidN/EFCoreSecondLevelCacheInterceptor/blob/master/src/EFCoreSecondLevelCacheInterceptor/EFEasyCachingCoreProvider.cs#L164 wiping out the whole cache
that when multiple servers modify the list of CacheDependencies at the same time in https://github.com/VahidN/EFCoreSecondLevelCacheInterceptor/blob/master/src/EFCoreSecondLevelCacheInterceptor/EFEasyCachingCoreProvider.cs#L91 the resulting list of keys was not consistent on all notes
We created a poc CacheProvider which interacts directly with Redis Sentinel and stores the CacheDependencies in Redis SortedSet:
https://gist.github.com/IntranetFactory/09338b44aa3c6ad7b2cab0284acfe14c
That provider does not need ClearAllCachedEntries and provides consistent distributed caching for us so far.
Is our assumption that https://github.com/VahidN/EFCoreSecondLevelCacheInterceptor/blob/master/src/EFCoreSecondLevelCacheInterceptor/EFEasyCachingCoreProvider.cs#L91 cause inconsistencies with distributed cache when multiple servers modify records in a table at the same time correct?
The text was updated successfully, but these errors were encountered: