Using EFCache as common cache for multiple projects

May 23, 2016 at 6:18 AM
Hi, i have a solution with multiple projects like WCF, Console and Website. i am using entity framework and one dbcontext for all of them.
I am trying to use EFCache as second level cache for entity framework. the problem is when i insert a new record from one of that projects others can't reload newly added data after change.
for example i add a new record via WCF service into my database and when i try to load data from website the newly added data don't load and website has its efcache.

please help me...

thank you
May 25, 2016 at 10:50 PM
If you are using InMemoryCache then each project has it's own cache and therefore they are not aware of changes to the database done in other projects. You would have to have a common cache (e.g. using Redis) where the cache would be common and if one of the projects changes the data in the database corresponding results are cleared.
May 26, 2016 at 10:19 PM
Thank you.

But, can i use Redis as second level cache for entity framework like EFCache ?
May 29, 2016 at 6:22 AM
I have not tried myself but here is a NuGet package that implements Redis as cache provider for EFCache.
Jun 9, 2016 at 6:55 PM
Thank you.

i use that package and my problem solved...