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.
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 ,
bhavin.chheda@vizualize.com
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
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.
I think its caching issue with the Star Community. So pls guide.
Thanks,
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;
}