Try our conversational search powered by Generative AI!

StarCommunity Caching Issue

We are using Netstar StarCommunity for our community website. I am working on the Club module of the StarCommunity. In Club module there is Blog Archive Section. Now problem is like when adding the Blog to a Club the Blog count does not gives updated result. If we log out and then log in then it gives proper count of the Blog.

I think its caching issue with the Star Community. So pls guide.


Also code for retriving the count of the Blog of the Club is as follows:

public int GetArticleArchiveCount(int groupId, int month, int year) {
   return GetEntryArchive(year, month, groupId).Count;

May 27, 2008 15:33

Hi Bhavin,

I'm not familiar with any method in EPiServer Community by the name "GetEntryArchive", but it would be interesting to see if it calls any of the built in Community methods to produce its result. Also I find it strange that the result is updated after log out/in since that is not something that results in cache invalidation.

If you could supply me with the contents of GetEntryArchive that would be great.

May 27, 2008 16:05

Hello Mattias,

Below is the code for GetEntryArchive..... 


 private EntryCollection GetEntryArchive(int year, int month, int groupId) {
   DateTime fromDate = new DateTime(year, month, 1);
   DateTime toDate = new DateTime(year, month, DateTime.DaysInMonth(year, month));

   EntryQuery query = new EntryQuery();
   query.Blog = new BlogCriterion();
   query.Blog.ID = new IntegerCriterion();
   query.Blog.ID.Value = GetGroup(groupId).MessageBlog.ID;
   query.Blog.Active = new BooleanCriterion();
   query.Blog.Active.Value = true;

   query.Blog.BlogType = new BlogTypeCriterion();
   query.Blog.BlogType.Value = BlogType.ClubMessage;

   query.PublicationStart = new DateTimeCriterion();
   query.PublicationStart.Value = fromDate;
   query.PublicationStart.Operator = ComparisonOperator.GreaterThan | ComparisonOperator.Equals;

   query.PublicationStart.Value2 = toDate;
   query.PublicationStart.Operator2 = ComparisonOperator.LessThan | ComparisonOperator.Equals;

   return BlogHandler.GetQueryResult(query);


Regards ,


May 27, 2008 16:42

Hi Bhavin,

The result of a query is updated when an object in the result is altered, which means that when new content is added that might match the criteria of your query, it will not be displayed until the cache has reached its timeout.

We are currently working on the functionality to be able to manually invalidate a query's cache when adding new content.

What I would suggest is to look at the built in MessageBlog.GetEntries method which covers alot of filtering in the case of publication and creation dates, and it will also result in much higher performance and instant cache invalidation when new entries are added.

If you anyway decide to use queries you can speed up your current query by removing

query.Blog.BlogType = new BlogTypeCriterion();
query.Blog.BlogType.Value = BlogType.ClubMessage;
since it is already guaranteed to be a ClubMessage blog because of the
query.Blog.ID = new IntegerCriterion();
query.Blog.ID.Value = GetGroup(groupId).MessageBlog.ID;
criterion you have applied. 
Best regards,
Mattias Nordberg 


May 27, 2008 16:53

One ugly, non-recommended way is to add this line when adding entities:

StarSuite.Core.Cache.CacheHandler.RemoveCachedObject(new string[] { "StarCommunityQueries", "Query" });

This would clear all caches made by the Query-system. I got the cache key from disassembling the StarCommunity.Core.Modules.Impl assembly.

Jun 26, 2008 11:14
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.