Support » Plugins » [Plugin: Yet Another Related Posts Plugin] When does the cache get built?

  • slobizman


    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • slobizman


    Pretty please.

    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

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

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


    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.

    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.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] When does the cache get built?’ is closed to new replies.