[Plugin: Yet Another Related Posts Plugin] Queries re-run even though should already be cached
-
I think my cache is being emptied for reasons unclear.
I’ve done a check on my site and in the span of refreshing the page 5 times Yarpp recalculated itself twice for the same post:
[141] => Array
(
[0] => insert into wp_1_yarpp_related_cache (reference_ID,ID,score) SELECT 16910, ID, (0+ (MATCH (post_content) AGAINST (‘energy government canada jobs clean change pollution harper climate must environment reduce carbon stephen country economy liberal quebec efficiency national ‘)) * 1+ (MATCH (post_title) AGAINST (‘energy jobs plan clean change liberal environment climate speech ‘)) * 1+ COUNT( DISTINCT tagtax.term_taxonomy_id ) * 1+ COUNT( DISTINCT cattax.term_taxonomy_id ) * 1) as score
from wp_1_posts
left JOIN wp_1_term_relationships AS thistag ON (thistag.object_id = 16910 )
left JOIN wp_1_term_relationships AS tagrel on (tagrel.term_taxonomy_id = thistag.term_taxonomy_id
AND tagrel.object_id = wp_1_posts.ID)
left JOIN wp_1_term_taxonomy AS tagtax ON ( tagrel.term_taxonomy_id = tagtax.term_taxonomy_id
AND tagtax.taxonomy = ‘post_tag’)
left JOIN wp_1_term_relationships AS thiscat ON (thiscat.object_id = 16910 )
left JOIN wp_1_term_relationships AS catrel on (catrel.term_taxonomy_id = thiscat.term_taxonomy_id
AND catrel.object_id = wp_1_posts.ID)
left JOIN wp_1_term_taxonomy AS cattax ON ( catrel.term_taxonomy_id = cattax.term_taxonomy_id
AND cattax.taxonomy = ‘category’)
where (post_status IN ( ‘publish’, ‘static’ ) and ID != ‘16910’) and post_date <= ‘2009-11-26 12:02:46’ and post_password =” and post_type = ‘post’
group by id
having score >= 3.00 order by score desc limit 4 on duplicate key update date = now()
[1] => 4.970920085907
[2] => require, require_once, include, get_sidebar, locate_template, load_template, require_once, dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, widget_liberalca_relatedstories->widget, related_posts, yarpp_related, yarpp_cache_enforce
)[141] => Array
(
[0] => insert into wp_1_yarpp_related_cache (reference_ID,ID,score) SELECT 16910, ID, (0+ (MATCH (post_content) AGAINST (‘energy government canada jobs clean change pollution harper climate must environment reduce carbon stephen country economy liberal quebec efficiency national ‘)) * 1+ (MATCH (post_title) AGAINST (‘energy jobs plan clean change liberal environment climate speech ‘)) * 1+ COUNT( DISTINCT tagtax.term_taxonomy_id ) * 1+ COUNT( DISTINCT cattax.term_taxonomy_id ) * 1) as score
from wp_1_posts
left JOIN wp_1_term_relationships AS thistag ON (thistag.object_id = 16910 )
left JOIN wp_1_term_relationships AS tagrel on (tagrel.term_taxonomy_id = thistag.term_taxonomy_id
AND tagrel.object_id = wp_1_posts.ID)
left JOIN wp_1_term_taxonomy AS tagtax ON ( tagrel.term_taxonomy_id = tagtax.term_taxonomy_id
AND tagtax.taxonomy = ‘post_tag’)
left JOIN wp_1_term_relationships AS thiscat ON (thiscat.object_id = 16910 )
left JOIN wp_1_term_relationships AS catrel on (catrel.term_taxonomy_id = thiscat.term_taxonomy_id
AND catrel.object_id = wp_1_posts.ID)
left JOIN wp_1_term_taxonomy AS cattax ON ( catrel.term_taxonomy_id = cattax.term_taxonomy_id
AND cattax.taxonomy = ‘category’)
where (post_status IN ( ‘publish’, ‘static’ ) and ID != ‘16910’) and post_date <= ‘2009-11-26 12:02:46’ and post_password =” and post_type = ‘post’
group by id
having score >= 3.00 order by score desc limit 4 on duplicate key update date = now()
[1] => 4.9449760913849
[2] => require, require_once, include, get_sidebar, locate_template, load_template, require_once, dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, widget_liberalca_relatedstories->widget, related_posts, yarpp_related, yarpp_cache_enforce
)now this 5 second is on a box with 10GB (out of 16GB) of ram allocated for mysql alone, now we do have a truckload of tags and etc and i’m fine with 5s for the first launch althought I would like to be able to trigger it in the background or something.
So I’m wondering what clears the cache and how/where in the code I could control that.
Thanks,
-Steph
http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/
- The topic ‘[Plugin: Yet Another Related Posts Plugin] Queries re-run even though should already be cached’ is closed to new replies.