Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 27th, 2008, 08:24 PM
Authorized User
 
Join Date: Mar 2007
Posts: 39
Thanks: 0
Thanked 1 Time in 1 Post
Default Forum Caching Bug in VB Code

Just found a nasty little bug in the VB code!

I'm in the process of writing a new Forum from scratch and could not come up with an effective way of caching the threads ViewCount, so I fired up the original TBH site to see how Marco dealt with it. Basically TBH updates the threads ViewCount field in the database every time the thread is viewed. However, the thread's cache is never purged when the ViewCount is updated, so I could not figure out how the ShowThreads page is reporting the proper ViewCount if the cache is stale. After several hours of head banging I finally discovered that the Forums cache was never working in the VB version. Consequently the Forum data is loaded from the DB for every page load.

The problem is a missing "Not" operator in the following BaseForum.vb method:

Code:
Protected Shared Sub CacheData(ByVal key As String, ByVal data As Object)
    If Settings.EnableCaching AndAlso Not IsNothing(data) Then
          BizObject.Cache.Insert(key, data, Nothing, DateTime.Now.AddSeconds(Settings.CacheDuration), TimeSpan.Zero)
    End If
End Sub
Without the "Not" the Forum data is never cached. Unfortunately, once the cache is fixed the thread's ViewCount will not display properly.

I know others have reworked the forum code and I would be interested to know how you dealt with the ViewCount issue.







Similar Threads
Thread Thread Starter Forum Replies Last Post
a big bug on a code busteronline ASP.NET 1.0 and 1.1 Basics 0 September 15th, 2008 09:11 AM
Bug in the Poll VB code? thuyvncr BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 April 21st, 2007 08:43 PM
Daylight Saving Time bug in the Snitz forum? Imar Forum and Wrox.com Feedback 4 March 29th, 2004 02:04 PM
Forum Bug Ben Horne Forum and Wrox.com Feedback 3 March 23rd, 2004 05:27 PM
Bug in the forum? Imar Forum and Wrox.com Feedback 9 June 25th, 2003 08:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.