• Hi WordPress lovers!
    I’m just curious, is the WP_Cache class and its functions still working in 2.8.4? I’m creating a simple function for my theme, used for retreiving attachments. The function wp_cache_add returns true and the cache is there (saw it using var_dump()). But on every page-load the cache disappears, even if I define the cache-time to 1800 (half an hour). So is WP_Cache still working or not?

    <br />
    <?php<br />
    function mytheme_attachment($post_id = NULL) {<br />
        global $post;<br />
        $post_id = (empty($post_id)) ? $post->ID : $post_id;</p>
    <p>    if ($cache = wp_cache_get('mytheme_attachment_' . $post_id, 'mytheme')) {<br />
            return $cache;<br />
        } else {<br />
            // Do something clever.</p>
    <p>        wp_cache_set('mytheme_attachment_' . $post_id, $data, 'mytheme', 1800);</p>
    <p>        return $data;<br />
        }<br />
    }<br />
    ?><br />

    Edit: someone seems to have the same problem.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP_Cache works in 2.8.4?’ is closed to new replies.