isotopsweden/wp-cachetop

This package is abandoned and no longer maintained. No replacement package was suggested.

Cache pages by generating static HTML and store it in Redis or Filesystem

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 1

Type:wordpress-plugin

dev-master 2016-08-15 13:43 UTC

This package is auto-updated.

Last update: 2023-03-01 00:24:42 UTC


README

Requires PHP 5.5.9

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.

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.

Example:

<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.

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