When i delete all topics they still left in Hot topis

  • 148 Views
  • Last Post 08 February 2018
  • Topic Is Solved
Eldar posted this 10 January 2016

why?

Order By: Standard | Newest | Votes
Sander posted this 11 January 2016

The HotTopics action (on the TopicController) uses the _cacheService, which stores your HotTopicsViewModel in the server memory for a long time (AppConstants.LongCacheTime), about a week.

So on database level nothing went wrong or something like that.

After 8 days your view will be updated, if for some reason you can't wait, I guess recycling your application pool on IIS could possibly empty the cache in the server memory, or you could do a call just for once somewhere in the code to the Clear() or InvalidateKey() method of the _cacheService.

  • Liked by
  • YodasMyDad
Carl Edwards posted this 08 February 2018

 Only recently started using MVCForum and been customising it to our needs. We have also just tripped over this issue and I have registered here just to say how much of a poor design decision I think this is.  Think of a scenario whereby a member puts up a defamatory topic. We need to act fast and we get reports and delete it.  Then to our immense surprise, the "Hot topic" list still shows the topic!  Which could very easily still have defamatory content in the title.  

To say "oh, go and recycle the app pool" is a solution, but it's not a good one. We could also hide "hot topics" and we may end up doing that.

YodasMyDad posted this 08 February 2018

Hot topics uses OutPutCache on the controller. Need to look into how to clear that output cache when a topic is deleted.

Carl Edwards posted this 08 February 2018

As a quick workaround (I don't want it using caching there at all) I changed the HotTopics action in the Topics controller as follows:

//var viewModel = CacheService.Get<HotTopicsViewModel>(cacheKey);
HotTopicsViewModel viewModel = null//don't want caching on hot topics

 

Close