WordPress.org

Ready to get started?Download WordPress

Forums

So how do you use cached data?? (8 posts)

  1. egarcia
    Member
    Posted 8 years ago #

    I've got some code running on my site, fetching data using wpdb->get_results(). In the Codex it seems like every Wpdb function caches its data, but I can't find anything on how to USE this cached data!! I've searched high and low but cannot find anything.

  2. Mark (podz)
    Support Maven
    Posted 8 years ago #

    I think it just sits there .....
    You know how to remove the cache if you need to ?
    http://wordpress.org/support/topic/54870?replies=15

  3. egarcia
    Member
    Posted 8 years ago #

    It can't just sit there, it has to be retrievable somehow, otherwise it'd be "wasted", not "cached".

    I've just opened up some random cache files, unfortunately I haven't come across anything resembling my queries; it seems like all the files are for are saving settings and parameters... although I did find the dashboard cache file, which is weighing in at over 180kb

  4. stopthepress
    Member
    Posted 8 years ago #

    Podz: "I think it just sits there ....."

    A cache area is where static pages (including graphics) are stored for immediate access instead of repeating a dynamic downloading process each time the same page is visited during a given period of time. I cannot even think that WP's cache just sits there. Of course some means to clear the cache is desirable for testing purposes or whatever (including lack of enough disc space), but disabling the cache for no reason is a bad idea unless WP do not use it. In such a case I agree with egarcia, it's just a resource 'waste' not a 'cache'.

  5. davidchait
    Member
    Posted 8 years ago #

    Hmmm. I didn't think generic getresults on wpdb were cached, I thought it was specific tables and data -- at least, for the 2.0 object-caching system. I could be wrong.

    And for WP-Cache, that caches on a page-level, so would cache a given accessed url but not a particular query itself.

    -d

  6. Mark (podz)
    Support Maven
    Posted 8 years ago #

    stopthepress - it also causes problems (try looking at the Comments tag category here) and on your average blog the possible benefit of having a cache is negligible.

  7. egarcia
    Member
    Posted 8 years ago #

    Upon reading the wpdb Class page over and over, I think I understood wrong before. It seems the "caching" it refers to is only within the class itself, not to a data file on the server. The data from the query is "cached" for use elsewhere in the same page during the same page request.

    I think now that WP2 has page caching, the codex might need some rewriting to better differentiate between query caching and page caching.

  8. davidchait
    Member
    Posted 8 years ago #

    From what I understand, WP2 does 'object caching', of particular frequent-accessed tables. Like options, or users. And when I 'caching' I mean to a file on disk, to speed up frequent requests for the same data.

    To the best of my knowledge, WP2 does not do generic query caching (which mySQL can be set up to do, if you run your own server), nor does it do request-level caching (which you can get using the WP-Cache plugin, a derivative of the original Staticize Reloaded hack).

    -d

Topic Closed

This topic has been closed to new replies.

About this Topic