VahidN / EFSecondLevelCache.Core

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

Caching entire tables #9

Closed adamhathcock closed 7 years ago

adamhathcock commented 7 years ago

I'd like to do something like declare table Address be cached.

So the cache would aggressively cache the entire table and run queries like: context.Buildings.Include(x => x.Address).ToListAsync() and building data is gathered from the DB but the address include uses the cache data.

Does that make sense? Does this currently work that? Is it possible?

Thanks!

VahidN commented 7 years ago

This is a query caching library (caching the whole query, not part of it). The hash of each query (the result of its produced SQL) will be computed plus other factors such as an optional user defined salt and then based on this hash, the related data will be retrieved form the cache. So each query will have a different hash and their data won't be shared. Here context.Buildings.Include(x => x.Address).Cacheable().ToListAsync() (caching the entire table and its related addresses) and context.Buildings.Cacheable().ToListAsync() (caching the entire table) will have 2 different SQL's and hashes and 2 different cached data.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.