Try our conversational search powered by Generative AI!

Starcommunity Caching issue with Rating

Vote:
 

I have a caching issue with the Rating entity in StarCommunity. The count of ratings on an entity is not updated after making a new rating.

I'm aware of that there is an caching issue with dynamic queries, but in this case I'm using the built in method RatingHandler.GetRatings(IRateableEntity, Int32, Int32, Int32%) which should have instant cache invalidation when the result of a query is updated (object in the result is updated, removed or added) if I understand this correctly?

Please see the code below:

Method to add new rating:
public static void Dig(IDigableEntity iEntity, IUser iUser)
{
  DQC.DL.User user = (DQC.DL.User)iUser;
  IAuthor author = (IAuthor)new UserAuthor(user.StarCommunityIUser);
  
  
IRating scIRating = null;
  if (iEntity is UserBlogEntry)
  {
     UserBlogEntry blogEntry = (UserBlogEntry)iEntity;
     scIRating = new Rating(blogEntry.StarCommunityEntry, 1, author);
     RatingHandler.Rate(scIRating);
  }
}

Method to get rating count of an entity:
public static int GetDigCount(IDigableEntity iEntity)
{
   int totalItems = 0;
   if (iEntity is UserBlogEntry)
   {
      UserBlogEntry blogEntry = (UserBlogEntry)iEntity;
     
RatingHandler.GetRatings(blogEntry.StarCommunityEntry, 1, int.MaxValue, out totalItems);

     
return totalItems;
   }

}

I´ve verified that a row is being added in the dbo.tblStarCommunityRatingLog when a new rating is being added, but the GetDigCount method is still returning 0 afterwards.

If I restart IIS, then the correct count is being shown.

I also have another question, is it possible to disable the whole caching-engine?

Looking forward to your answer.

Thank you in advance!

#22106
Jul 23, 2008 17:04
Vote:
 

Sorry for the strange code-markup in the post above, I hope it's readable.

#22107
Jul 23, 2008 17:07
Vote:
 

Would greatly appreciate if I could receive an answer.

Thank you in advance.

#22857
Aug 19, 2008 12:12
Vote:
 

Hi,

While we're taking a further look into your issue, make the following call when you rate an object:

CacheHandler.RemoveCachedObject("starCommunityRating", "RatingList", "null", StarCommunityFactoryBase.GetTypeName(typeof(blogEntry.StarCommunityEntry)), blogEntry.StarCommunityEntry.ID.ToString());

This will make a very narrow cache invalidation and should work for you. 
#22914
Aug 20, 2008 16:31
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.