Should AlwaysCachedQueriesRegistrar and BlacklistedQueriesRegistrar be singletons?

Jul 1, 2015 at 12:14 PM

I noticed that you advised someone else in another thread to not use a cache everything caching policy, which I'd probably agree with (at least for my purposes).

The question I have is around the Cache and NotCache extensions methods and the implementations behind them.

At present, my understanding is that one caller would effectively decide for the entire application that a query is cached.

What are your thoughts in terms of allowing a query to be cached for one caller but not another within the same application?

Jul 1, 2015 at 12:15 PM
Edited Jul 1, 2015 at 12:17 PM
Just realized my title is rather poorly worded and doesn't convey the question at all - don't know what I was thinking! - apologies!
Jul 4, 2015 at 7:59 PM
Hi letdowncrush,

What do you refer to as "caller"? Is it like a web app where a caller is the user or the caller is the function that calls Cached/NotCached methods? I don't quite get your scenario.

Regardless, the EF cache operates on queries (and parameters) - query is a query and either you want to cache the results or you don't want to cache the results. If results for a query are cached they should be valid as long as there is a command that touches corresponding tables in which case the results are invalidated. So I am not sure how "multiple callers" change this flow.