Closed nicostubi closed 4 years ago
The easiest way would be to swap out the CachingService implementation of IAppCache for MockMemoryCache. This could be done during application startup if you are using dependency injection.
Using the mock is the same approach you would often use in unit tests, so have a look at https://github.com/alastairtree/LazyCache/wiki/Unit-testing-code-using-LazyCache .
And what would be the advantage compared to my solution above?
Mocking is great for unit tests, not really for production code.
Hello,
Isn't there a simple way to disable the cache?
The only thing I can think of is, to set a DefaultCachePolicy.DefaultCacheDurationSeconds = 0
Best, Nico