[bd] Cache [Deleted]

I think it will work 50% of the time. As I said, best to disable caching for thread page if you want to count guest views.
I figure it out now.
Since last page of the thread is not cache, If the user already seen the notice then it will also work for other pages.
 
But when using this addon and Limit view, Thread Pages doesn't work with Limit View, just the last page works.
You right, it does cache it the page before, but it only shows level 1, not 2. In other words, it wouldn't block the user from viewing a thread, so it doesn't matter. I don't think it worth setting cache TTL to 0 because of that. They will get the level1 notice anyway.
 
I figure it out now.
Since last page of the thread is not cache, If the user already seen the notice then it will also work for other pages.
You right, it does cache it the page before, but it only shows level 1, not 2. In other words, it wouldn't block the user from viewing a thread, so it doesn't matter. I don't think it worth setting cache TTL to 0 because of that. They will get the level1 notice anyway.
In short, guests will be able to see more pages than they should if you have both add-ons installed ;) Other than that, both will work together without causing errors etc.
 
Actually you do need to set TTL to 0, which makes the entire thing not optimal :(
If a page is cached for guests, they won't see the notice when they visit a page, but the cookie will still count them as a visitor. So a guest can basically view 10 cached pages (if it is configured as 10 in level 2 - to block them in order to register/log-in), so it will block them right away without giving any level 1 (only a notice, without blocking - which is 5 threads on my board).
@xfrocks
Can you think on another way to avoid this situation without setting TTL to 0?
@RoldanLT good catch, I haven't thought about it.
 
  • Like
Reactions: rdn
Thread View (older pages only: if a thread has 10 pages, only the first 9 pages will be cached)
But how about those threads with just a single page (post 10 below).
As I notice it also cache threads with no page 2,3,4, etc.
 
No, it does not cache thread with only one page.

I just installed this and it works great. However I would suggest that caching a thread with one page would be a very useful modification.

I suggest this because my site often gets spikes in traffic (sometimes thousands of views per day) for fairly new threads which have less than a page of responses.

You could fairly easily make it flush that page upon modification by hooking into XenForo_DataWriter_DiscussionMessage_Post, public function save(){, and get the thread id from $this->_newData['xf_post']['thread_id'] (new post) or $this->_existingData['xf_post']['thread_id'] (edited post)
 
I just installed this and it works great. However I would suggest that caching a thread with one page would be a very useful modification.

I suggest this because my site often gets spikes in traffic (sometimes thousands of views per day) for fairly new threads which have less than a page of responses.

You could fairly easily make it flush that page upon modification by hooking into XenForo_DataWriter_DiscussionMessage_Post, public function save(){, and get the thread id from $this->_newData['xf_post']['thread_id'] (new post) or $this->_existingData['xf_post']['thread_id'] (edited post)
Doing that is pretty risky but I may add it as an option in future version.
 
Thanks, but what's the risk? The worst you can do is flush a single page that does not need flushing when someone makes an edit/post.
Many things can affect the rendering of thread like lock/unlock etc., not just post edit/new post. Sometimes add-on makes change to thread too. That's why it is risky.
 
Many things can affect the rendering of thread like lock/unlock etc., not just post edit/new post. Sometimes add-on makes change to thread too. That's why it is risky.

Don't those things apply to second pages though?

Anyway it would be great to have as an option.
 
Today I had a thread that was very popular that illustrates what happens when the cache kicks in. I posted it, and immediate traffic started to steadily climb, with the graph below representing around 10,000 guests looking at the page. CPU load steadily climbed until the second page was reached, then the cache kicked in, and it dropped back to much more manageable levels, even though there was no let-up in the growth
Metabunk-CS 2014-01-30 17-33-07.webp
So:
  1. Well done, the cache worked great!
  2. It would have been great to have the option to switch on caching threads with one page :) I actually made some posts just to kick it over onto the next page.
 
Back
Top Bottom