> On Dec 23, 2019, at 6:09 PM, John Huss <[email protected]> wrote: > > I've decided to try using a simple QueryCache subclass I'm calling > PartitionedQueryCache > <https://gist.github.com/johnthuss/c5f6b6ce76036afd028199da312ddb08> which > will enable independent lifetimes for the shared cache versus local cache. > I'm going to run with this for a while. If there is any interest I can > contribute it. > > Thanks!
Ah right. There's another dimension to this discussion - separation of the long-living from short-living caches. This can also be achieved at the query level by using different cache groups. Each cache group maps to its own EhCache Cache object that has its own size and expiration settings. > On Dec 23, 2019, at 6:09 PM, John Huss <[email protected]> wrote: > >> 2. Set fairly short expiration times. E.g. 10x of your average response >> time (say 10-30 sec). BTW, the above statement from my previous email needs some clarification. When implementing "request-scope cache", you actually don't care if the expiration time is too long, as the cache is not shared between requests (if each request has its own ObjectContext). Eviction happens because of the *size* constraint, not expiration constraint. So the conclusion here is that such a cache can be long-lived as well, just size-limited. Andrus
