mesdouri - yes, that looks fine too (my method would have got it from the cache too (via the DAL check), but this is a very neat way too with one less 'step' in the code logic!!)
however, you'll need to cast the cache as so:
public static bool IncrementArticleViewCount(int id)
{
//BizObject.PurgeCacheItems("articles_article_" + id.ToString());
//Article article = Article.GetArticleByID(id);
Article article = (Article)BizObject.Cache["articles_article_" + id.ToString()];
if (article != null)
{
article.ViewCount++;
}
return SiteProvider.Articles.IncrementArticleViewCount(id );
}
good stuff...
[edit] - not sure if getting it direct from the cache (versus getting it via Articles.GetArticleByID) actually works correctly!! testing it just now but not 100% sure...
jimi
http://www.jamestollan.com