November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Sorry for the strange code-markup in the post above, I hope it's readable.
Would greatly appreciate if I could receive an answer.
Thank you in advance.
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.
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!