wordpress-plugin wp-cachetop
Cache pages by generating static HTML and store it in Redis or Filesystem
isotopsweden/wp-cachetop
Cache pages by generating static HTML and store it in Redis or Filesystem
- Monday, August 15, 2016
- by fredrikforsmo
- Repository
- 3 Watchers
- 2 Stars
- 1 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
Cachetop
Requires PHP 5.5.9, (*1)
Cache plugin that create static HTML files that can be stored in Redis or on the file system. The default cache time is one hour. All posts that are cached will have to post meta keys, _cachetop_hash
with the cache hash id and _cachetop_time
with the time when the post was cached., (*2)
Installation
composer require isotopsweden/wp-cachetop
Unfragment
With cachetop_unfragment( $fn, array $args = [] )
you can tell Cachetop to replace the cached html with the output of the given function or static method., (*3)
Example:, (*4)
<div class="widget_shopping_cart_content">
<?php cachetop_unfragment( 'woocommerce_mini_cart' ); ?>
</div>
The constant DOING_CACHETOP
will be defined when Cachetop calls a function or static method when it replacing cached html with fresh html., (*5)
Will not cache:
- Logged in users (if not changed with the filter).
- Search page.
- 404 page.
- Feed page.
- Trackback page.
- Robots file.
- Preview page.
- Password protected post.
- WooCommerce cart page.
- WooCommerce checkout page.
- WooCommerce account page.
- Only GET requests, so no POST, PUT, PATCH, UPDATE, DELETE or so.
- No GET requests with query strings.
Filters
-
cachetop_options
should be used to change Cachetop options, like changing from Redis to file system or setting expiration time.
-
cachetop_bypass
can be used to tell if a page that should be cached should be bypassed.
-
cachetop_exclude_url
can be used to exclude urls, the first argument is the current url.
-
cachetop_bypass_logged_in
can be used to tell if logged in users should be cached, this is bad if the admin bar is showed.
Functions
-
cachetop_flush_hash( $hash )
can flush cache by hash.
-
cachetop_flush_post( $post_id )
can flush post by post id.
-
cachetop_flush_url( $url = '' )
can flush cache by url or the current url, query strings will be removed.
License
MIT © Isotop, (*6)
dev-master
9999999-dev
Cache pages by generating static HTML and store it in Redis or Filesystem
Sources
Download
MIT
The Requires
The Development Requires
plugin
wordpress