poppastring / dasblog-core

The original DasBlog reimagined with ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replace client-side caching

poppastring opened this issue · comments

Replace client-side caching...
[ResponseCache(Duration = 14400, Location = ResponseCacheLocation.Any)]

...with serverside caching
private readonly IMemoryCache memoryCache;

  • Caching on the home page should be broken when we add a new post or comment (includes status updates and deletes).
  • Caching on the archive page should be broken when we add a new post.
  • Caching on the category page should be broken when we add a new post.
commented

Hi @poppastring seems like this enhancement has already been implemented.

@musmanrafiq Still exists in the ArchiveController

Hi @poppastring. I've taken this issue and are looking at adding IMemoryCache to the ArchiveController. Please can you help me understand what you mean by,Caching on the archive page should be broken when we add a new post., in the issue description above

Hey @zukomgwili

The term "break" really means I want the cache invalidated so that it is removed from memory. In the BlogPostController you will see a private method called BreakSiteCache (which removes the cache key) and that invalidates the RSS and Front page cache when I add or edit a new post. That should serve as a good example if we create History for the History cache, we will want to break/invalidate its cache in the same way and at the same time.

As we have to do this in multiple places it may be a great time for some refactoring (based on your comfort level).

Send me PR and I will gladly review what you come up with and we can discuss it.

Thanks!

Thank you @poppastring for the clarification, that helps a lot 👍