VahidN / EFSecondLevelCache.Core

Entity Framework Core Second Level Caching Library
Apache License 2.0
326 stars 50 forks source link

Cache not being invalidated randomly #13

Closed asfaya closed 6 years ago

asfaya commented 6 years ago

Summary of the issue

Hi, I'm using the tool and it's working very nice, However, I'm finding from time to time that updating an entity does not invalidate the cache; or that when a new entity is added, is correctly saved on database but cache is not invalidated and the new entity is not visible.

Environment

I use Redis for cache The application is netcore 2

Operating system: Win 7 / Windows Server IDE: Visual Studio 2017

Example code/Steps to reproduce:

I can't reproduce since it's happening randomly. Might not happen in days and suddendly it occurs

asfaya commented 6 years ago

Hi, I've been trying to gather more information regarding this issue.

What I've noticed querying the Redis is that some objects are saved duplicated. That is, I can find the same object more than once on Redis db. Is it possible that at the time of invalidation one of the instances is invalidated and one isn't?

Also (a question more than an issue), how should I handle cases where a query returns an object tree? For example, imagine a query that returns a list of objects with this structure: ProductLine -- ProductFamily -- Product

This query is ran very often and data changes not very often, so it seems a great candidate for caching There is a CRUD screen to modify products

The issue I'm facing is that when a product is modified, the cache is not being correctly invalidated, so it keeps returning the list with objects in an old state.

I hope you can help me with this. The library enhances performance greatly, however we are in need of flush redis db from time to time manually because of these issues.

Thanks in advance,

Andrés

VahidN commented 6 years ago

doen't work for you or with redis, don't use it. thank you.