W3 Total Cache – Cache auto pruning when a new comment is added
-
Hi,
I’m using W3 Total Cache with object cache enabled through memcache.I wrote a custom plugin that show the latest X comments of the blog.
I want to cache the results in a transient cache object that expire every X minutes.This is the code:
$key = 'recent_comments'.md5($sql); $comments = wp_cache_get($key,$group); if ( empty( $comments ) ) { $comments = $wpdb->get_results($sql); wp_cache_set( $key, $comments, $gruop, RECENT_COMMENTS_TIME ); } foreach ($comments as $key => $comment) {
The caching does work, but when someone adds a new comment the cache object is erased, and I don’t know why.
Anyone can help me?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘W3 Total Cache – Cache auto pruning when a new comment is added’ is closed to new replies.