WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Yet Another Related Posts Plugin] When does the cache get built? (6 posts)

  1. slobizman
    Member
    Posted 4 years ago #

    No problems, I love YARP. Just a question so I understand it better.

    I'd like to understand when is it that the cache is modified, added to? Is it when I create a post? Or is it when a user clicks on an article for the first time? And if I change the relations criteria, does it then rebuild the entire cache at that time.

    I've got 2500 articles in an install, so I want to make sure I know what it's doing.

    Thanks so much.

  2. slobizman
    Member
    Posted 4 years ago #

    Pretty please.

  3. jimsky7
    Member
    Posted 4 years ago #

    I just discovered some info that might be relevant to your question.

    The cache seems to be built on a post-by-post basis - when a particular post is browsed by a site visitor, its "related post IDs" go into a database table along with all of the posts that it "points to."

    So for a theoretical post 9812 it might go into the table as:
    +--------------+------+
    | reference_ID | ID |
    +--------------+------+
    | 9812 | 0 |
    | 9812 | 7761 |
    | 9812 | 8032 |
    | 9812 | 8049 |

    meaning that 7761, 8032 and 8049 are related to (I'd say "pointed to by") 9812. I don't know what the "0" entry is...

    Posts 7761, 8032 and 8049, however are -removed- from the cache at this same time, so they'd have to be re-indexed in the future.

    So if you browse to one of them at a future time, they'll get rebuilt by YARPP and entered into the table at that time (with their IDs appearing in the reference_ID column.

    I can kinda see how Mitcho would have thought that it would be useful to remove 9812 (in my case) from the table just in case it needed to be refreshed because some newly-published post now refers to it - but I don't know that this is a necessary condition and in my case it causes "thrashing" because posts are frequently related to each other in "clusters" and browsing from one to the other causes long cache rebuilds taking about 15 seconds of CPU time each.

    I find that to be kind of a "bug" and reported it in

    http://wordpress.org/support/topic/355509?replies=1

    Hopefully this info helps you understand something about when cache entries are created.

  4. William Bowles
    Member
    Posted 4 years ago #

    does this have anything to do with code I posted on the original thread concerning the mysql overload that my site was experiencing?

    Bill

  5. jimsky7
    Member
    Posted 4 years ago #

    I can't tell if it relates to your overload. It was certainly overloading 2 of my 4 CPUs for 15 seconds or more every 3rd or 4th time a page was being viewed.

    The cause in my case was the algorithm used to determine how long entries are kept in the cache. So that was the nature of my question.

    I'm looking into the code myself at the moment and will end up modifying the algorithm to make my problems go away... don't know yet how useful this will be for others.

  6. William Bowles
    Member
    Posted 4 years ago #

    What about the author? It's a shame as it's the only of its kind that used to actually work, at least on my setup and as my site is a news and current affairs 'blog' being able to cross-reference articles is a tremendously useful to readers.

    Bill

Topic Closed

This topic has been closed to new replies.

About this Topic