Code Monkey home page Code Monkey logo

wp-cache's Introduction

=== WP-Cache ===

Tags: caching, performance
Contributors: gallir

Note: this is the last released version of wp-cache in September 21st, 2007


WP-Cache is an extremely efficient WordPress page caching system to make you site much faster and responsive. It works by caching  Worpress pages and storing them in a  static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and the building the page from the database. WP-Cache allows to serve hundred of times more pages per second, and to reduce the response time from several tenths of seconds to less than a millisecond.

WP-Cache started from the '''Staticize Reloaded''' by matt and billzeller. Most of their recommendatiosn also apply to WP-Cache. Current version, WP-Cache2, is a huge improvement over previous versions of WP-Cache.

WP-Cache is composed of two parts:

1. Two-phases Wordpress hooks. The first is called at the very begining  --wp-cache-phase1.php-- when just few code has been compiled. The second --wp-cache-phase2.php-- after all plugins have been executed. The first phase checks if the requested URL is already cached, if so it serves from the static file and finishes. The second phase stores the generated page in a static file for further request.

2. The WP-Cache plugin. This plugin configures and manages the whole process. It is easy to use and self-documented. It allows yoy to enable or disable cache, define expiration time for static pages, define rules for rejecting and accepting which URLs and php files can be cached, and shows and delete pages in cache.

== Installation ==

1. Upload to your plugins folder, usually `wp-content/plugins/` and unzip the file, it will create a `wp-content/plugins/wp-cache/` directory.

2. If you have Compression turned on under Miscellaneous options, turn it off.

3. Activate the plugin on the plugin screen.

4. Go to "Options" administration menu, select "WP-Cache" from the submenu, the plugin will try to autoconfigure everything.  The plugin will try to autoconfigure everything, in case of failure --normally due to the lack of files' permissions-- it tell you and give the instructions to solve the problems.

== Manual Installation ==

In case you don't want to make `wp-config.php` writeable by the server, or you want to make all steps manually:


1. Upload to your plugins folder, usually `wp-content/plugins/` and unzip the file, it will create a `wp-content/plugins/wp-cache/` directory.

2. If you have Compression turned on under Miscellaneous options, turn it off.

3. Create `wp-content/cache`directory and make sure the web server can write in it.

4. Make `wp-content` directory writeable by the web server.

5. Create a symbolic link from wp-content/advanced-cache.php to wp-content/plugins/wp-cache/wp-cache-phase1.php.

    ln -s   wp-content/plugins/wp-cache/wp-cache-phase1.php wp-content/advanced-cache.php

6. Add the following line to you wp-config.php` file:

    define('WP_CACHE', true);

7. Go to "Options" administration menu, select "WP-Cache" from the submenu and enable cache.

== Frequently Asked Questions ==

= Do I really need to use this plugin? =


From "Staticize Reloaded". Probably not, WordPress is fast enough that caching usually only adds a few milliseconds of performance that isn't really perceptible by users. Some reasons you may want to use Staticize Reloaded:

* If your site gets Slashdotted
* If you're on a very slow server
* If you've had a complaint from your host about performance

= How can I tell if it's working? =

WP-Cache adds some stats to the very end of a page in the HTML, so you can view source to see the time it took to generate a page and rather it was cached or not. Remember that the cache is created on demand, so the first time you load a page it'll be generated from the database. This first time WP-Cache will add  a lines with the total time needed to create the page, if the page is directly served from the cache, it adds a second line telling it was served from cache.

= I see gibberish on the screen when I activate this plugin? =

Make sure that you deactivated compression on the Miscellaneous options screen and that gzip encoding is turned off on the PHP level.

= How do I make certain pages stay dynamic? =

You can specify rules that reject request based on URI strings and also specify acceptable files for caching.


= How do I make certain parts of the page stay dynamic? =

It's compatible with Staticze Reloaded. From their FAQ:

There are two ways to do this, you can have functions that say dynamic or include entire other files. To have a dynamic function in the cached PHP page use this syntax around the function:

`<!--mfunc function_name('parameter', 'another_parameter') -->
<?php function_name('parameter', 'another_parameter') ?>
<!--/mfunc-->`

The HTML comments around the mirrored PHP allow it to be executed in the static page. To include another file try this:

`<!--mclude file.php-->
<?php include_once(ABSPATH . 'file.php'); ?>
<!--/mclude-->`

That will include file.php under the ABSPATH directory, which is the same as where your `wp-config.php` file is located.


= I removed WP-Cache and now Wordpress does not work =

This occurs because Wordpress still try to run `advanced-cache.php`. Remove the following line to you wp-config.php` file:

    define('WP_CACHE', true);



Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.