SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    PHP/Rails Developer Czaries's Avatar
    Join Date
    May 2004
    Location
    Central USA
    Posts
    806
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Caching for forums

    There was a previous thread posted here that briefly touched on why forums can't cache full pages in a post. Some of the reasons given were:
    - User authentication on every page
    - Many customizable elements, like subscribed and "new" threads that have to be highlighted/bolded
    - "Who's online" and other dynamic areas that change very frequently

    But then I was thinking... What if you DID cache whole pages (except maybe the "who's online" section), and then use javascript to go over the page and highlight/bold all the applicable areas/unviewed threads, etc. that required special distinction? If you set aside the 1-2% or so of users who have javascript turned off, this technique could potentially save TONS of server load. Since forums are known for being especially bad resource hogs, an implementation like this just might be worth it. Any thoughts?

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd rather take the approach on caching old or closed threads..

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    Norway - Oslo
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If forums werent so damn bloated with "not needed features" caching would be a lot easier.
    Say you skipped showing whos online in the thread (the green light on the left hand side of the actual post the user made), then you could cache the entire thread content as static html and simply append the "whos reading this" etc as dynamic data.

    Your approach with javascript still requires this data to be loaded, but through a seperate request, and it would require the forum markup to be somewhat sane. Most forums hardly qualifies as serving html, most return some unusable tag soup from hell which makes it a bit hard to apply this.
    Raymond Julin
    Developer: Hardware.no, Amobil.no, Gamer.no, Prisguide.no ...
    Owner: Kulturo.no

  4. #4
    PHP/Rails Developer Czaries's Avatar
    Join Date
    May 2004
    Location
    Central USA
    Posts
    806
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Findus View Post
    Your approach with javascript still requires this data to be loaded, but through a seperate request, and it would require the forum markup to be somewhat sane. Most forums hardly qualifies as serving html, most return some unusable tag soup from hell which makes it a bit hard to apply this.
    It's true that this would be a very difficult and very time-consuming effort to apply to current existing forum software, but I'm more talking about the theory of the practice in general - are the benefits worth the drawbacks, etc?

    Like you say, the markup would most definately have to be well-structured and validated in some way to get the DOM javascript to be reliable and working well on all browsers. But that requirement in itself can only lead to good things compared to what most forum systems are today. I was thinking something along the lines of checking forum timestamps and using javascript arrays to store the data for subscribed threads, threads with new posts, etc. You would then use DOM scripting to find the individual threads (by thread id) and apply the styling to those titles or table cells.

    Also, with the little "green light" showing if the user is on, that could be a simple php-processed javascript bit that prints the green or dark light, depending on if the user is online or not.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •