WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] WP File Cache (16 posts)

  1. shidouhikari
    Member
    Posted 4 years ago #

    Hello!

    I've been using WP File Cache, it implements WP_Cache persistance by saving cache in HD and loading it back on every page load. It's very simple and efficient (for shared hosting), my pageload decreased 20-40% and database query almost 80%!

    I see W3 Total Cache uses advanced-cache.php and not object-cache.php. A quick look in wp-settings.php it seems both files are independent and not related to each other.

    I'm gonna do more tests and understand how Total Cache works. For now I just wanted to know if both plugins can be used together, or I should deactivate File Cache (it's deactivated ATM).

    In my first tests I left Database caching enabled but db queries went back to 517. File Cache makes it drop to around 120, and I didn't see anything impressive from timer_stop().

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Simply use the development release which already provides object caching: http://wordpress.org/extend/plugins/w3-total-cache/download/

  3. shidouhikari
    Member
    Posted 4 years ago #

    I reactivated File Cache and queries are back to 140, it seems Total Cache isn't persisting WP_Cache at all. It seems they can be used together, at least I don't see anything wrong in pages.

    My local server has full RAM used and page load time can't be compared unfortunately, it varies from 10s to 15s on each load.

  4. shidouhikari
    Member
    Posted 4 years ago #

    wow! lol :D

    So future version will start supporting WP_Cache? I'm gonna test it too, but tomorrow I'm gonna sleep now ;)

    tnx for the record quick reply

  5. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Yes, and you can modify settings on which objects to cache or not. Please let me know how things go for you.

  6. KimJCastleberry
    Member
    Posted 4 years ago #

    Just thought I'd add that I switched up (from stable) to the development version today. First options page mostly all enabled except debug and CDN. Enabled WP_Cache in the wp-config folder.

    Is there anything else I need to setup/add/configure on the server besides what's in the plugin's installation tab in the wp database?

    I'm a little concerned that the high server loads I've run into recently are associated with my switch to this plugin from wp super cache (which was a nightmare to uninstall). Can you comment on whats presented in this post: http://www.nerdgrind.com/w3-total-cache-versus-wp-super-cache/ Frederick?

    Kimberly

    PS: I sent a connection invite on linkedin since you have your profile up on the wordpress.org link Look forward to connecting

  7. KimJCastleberry
    Member
    Posted 4 years ago #

    Switching up to the dev version and enabling wp_cache and the new settings enabled me to be detected as running gzip on the WooRank test and a few others. It would seem to me this is improvement. Yay!

    Is setting wp-content to 777 really necessary at this point or can a user get away with simply installing via dashboard -> plugins -> add new (as I had done previously)

  8. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    @KimJCastleberry:

    Is there anything else I need to setup/add/configure on the server besides what's in the plugin's installation tab in the wp database?

    The depends on the bottlenecks of your site. You can contact me for advice.

    The link to which you prefer is quite old among other things mentioned there are irrelevant or opinion as opposed to fact.

  9. KimJCastleberry
    Member
    Posted 4 years ago #

    Thanks Frederick on both accounts. I was assuming as much about the post but you seemed like just the person to ask! I'm going to let this run a day or two and look at numbers before I take any more of your time.

    Have a wonderful day!
    Kimberly

  10. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Ok.

  11. shidouhikari
    Member
    Posted 4 years ago #

    Sorry for the delay, I've not been having time to test new plugins.

    I downloaded newest develop version and I'm gonna test it now, I'd like to make some questions to better understand how all these caching are done.

    1) I noticed "object cache" is implemented together will all other caches, it seems each kind of cache is an interface and calls another instance which is what effectively caches data. So, "object cache" isn't fully new implemented right? it's using cache implementations that are already used in 0.8?

    2) Where is W3TC_LIB_W3_DIR defined? I see it being used but can't find what's it.

    3) I also can't find where caches are being stored in HD. It seems you md5 group and key and I have no idea where it goes.

    4) What does database cache do? As I understood it, you extend original wpdb class, and caches all queries results, then when the same query is requested you get it from cache instead of accessing database, is that correct?

    But is it reliable? I believe "object cache" exists exactly so that developers can avoid database queries when previous queries are cached and they believe data hadn't changed. If you do the same thing in database-access layer, creating 2 layers of caching, isn't there the risk of changed data being ignored and taking away from developers the capacity to control when cache can and can't be used?

    I also noticed something annoying. If I delete wp-content files, they are gone forever. To force them being copied again I must deactivate and reactivate the plugin, but doing so I lose its settings. I suggest adding an option to delete all files and recreate them, for situations when they may need some fix. And another option to reset options, removing the reset from deactivation hook.

    In overall, Total Cache's "object cache" seems to be a bit faster than File Cache and much better maintained. I'll keep testing and probably use it when a stable version comes out :)

  12. shidouhikari
    Member
    Posted 4 years ago #

    Another question, is page cache similiar to what Super Cache does? If I enable it, will hooks like 'wp_footer' stop firing on every pageload?

  13. shidouhikari
    Member
    Posted 4 years ago #

    Ok I understood where cache is being stored and how you use md5 to define its path.

    I have some more questions :p

    1) Where's the best place to define W3TC_CACHE_FILE_OBJECTCACHE_DIR before your define file? I'd like to leave it, and if possible the whole w3tc folder, outside WP_CONTENT_DIR

    2) In ObjectCache.php line 226, I don't understand it... if $key === $data ? shouldn't it be $this->cache[$key] === $data ? The key will never be equal to the data, they have no === relation at all.

    3) I LOVED how you added expire data inside the cache so that it can be retreaved later, gratz! :D

    4) In define.php line 418, $wpdb->prepare() is better than sprintf() :p

    If you allow me, I'd like to make a request to make it easy, if you want I can implement it and give you the code...

    For the cache path, instead of md5'ing everything and using 3 first letters for those folders, could you use /site/group/id/? It's impossible to see what's cached and where each cache is if you use md5. Having their proper names would make it much easier.

  14. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Another question, is page cache similiar to what Super Cache does? If I enable it, will hooks like 'wp_footer' stop firing on every pageload?

    wp_footer() will work, but a cached page is a cached page.

    1) I noticed "object cache" is implemented together will all other caches, it seems each kind of cache is an interface and calls another instance which is what effectively caches data. So, "object cache" isn't fully new implemented right? it's using cache implementations that are already used in 0.8?

    Object cache is a completely new implementation. It uses any of the supported cache storage engines available in the plugin.

    2) Where is W3TC_LIB_W3_DIR defined? I see it being used but can't find what's it.

    w3-total-cache/inc/define.php

    3) I also can't find where caches are being stored in HD. It seems you md5 group and key and I have no idea where it goes.

    wp-content/w3tc/objectcache/

    4) What does database cache do? As I understood it, you extend original wpdb class, and caches all queries results, then when the same query is requested you get it from cache instead of accessing database, is that correct?

    Database cache caches DB calls. not all database results can be cached in object cache.

    But is it reliable? I believe "object cache" exists exactly so that developers can avoid database queries when previous queries are cached and they believe data hadn't changed. If you do the same thing in database-access layer, creating 2 layers of caching, isn't there the risk of changed data being ignored and taking away from developers the capacity to control when cache can and can't be used?

    W3TC has 3 layers of cache: page cache, object cache, database cache.

    1) Where's the best place to define W3TC_CACHE_FILE_OBJECTCACHE_DIR before your define file? I'd like to leave it, and if possible the whole w3tc folder, outside WP_CONTENT_DIR

    Change it in define.php

    2) In ObjectCache.php line 226, I don't understand it... if $key === $data ? shouldn't it be $this->cache[$key] === $data ? The key will never be equal to the data, they have no === relation at all.

    The bug is fixed in the next development release.

    4) In define.php line 418, $wpdb->prepare() is better than sprintf()

    sprintf() is faster.

  15. shidouhikari
    Member
    Posted 4 years ago #

    tnx for the replies :D

    wp_footer() will work, but a cached page is a cached page.

    So, in a cached page those hooks aren't executed?

    Object cache is a completely new implementation. It uses any of the supported cache storage engines available in the plugin.

    Yeah that's what I mean, I typed it wrong :p

    Does it use the same engines that were available before, and what effectively writes cache to HD was already available?

    Database cache caches DB calls.

    What do you mean by DB calls? The SQL string that's sent to MySQL or the data that's queried?

    W3TC has 3 layers of cache: page cache, object cache, database cache.

    And is database cache reliable, don't we have the risk of data being changed and cache doesn't know it?

    And if database cache is in use, then "object cache" isn't needed at all, or is it still useful?

    sprintf() is faster.

    Interesting :D

  16. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    So, in a cached page those hooks aren't executed?

    No a cached page is not processed by WP.

    Does it use the same engines that were available before, and what effectively writes cache to HD was already available?

    The point is simple, the engines are just stores, each has it's own hash or directory structure.

    What do you mean by DB calls? The SQL string that's sent to MySQL or the data that's queried?

    The result returned for DB queries.

    And is database cache reliable, don't we have the risk of data being changed and cache doesn't know it?

    Low garbage collection time and ability to ignore queries that change frequently. Caching is caching, accept the compromises.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic