Commit 2235fc0f authored by Benjamin Adams's avatar Benjamin Adams
Browse files

Updated docs

parent 692ef430
......@@ -4,11 +4,11 @@ Cache Wordpress using Redis, the fastest way to date to cache Wordpress.
### Requirements
[Wordpress]( - CMS framework/blogging system
[Redis]( - Key Value in memory caching
[Predis]( - PHP api for Redis
* [Wordpress]( - CMS framework/blogging system
* [Redis]( - Key Value in memory caching
* [Predis]( - PHP api for Redis
### Setup
== Installation ==
Install Redis, must have root access to your machine. On debian it's as simple as:
......@@ -19,8 +19,10 @@ On other systems please refer to the [Redis website](
Move the folder wp-redis-cache to the plugin directory and activate the plugin. In the admin section you can set how long you will cache the post for. By default it will cache the post for 12 hours.
Note: This plugin is optional and is used to refresh the cache after you update a post/page
Move the `index-wp-redis.php` to the root/base Wordpress directory
Change the `index.php` to:
Move the `index-wp-redis.php` to the root/base Wordpress directory.
Move the `index.php` to the root/base Wordpress directory. Or manually change the `index.php` to:
$seconds_cache_redis = 60*60*12; // 12 hours by default
$seconds_cache_redis = 60*60*12; // 12 hours by default, you can change in this in wp-admin options page
$ip_of_your_website = ''; //You must set this to the IP of your website
$secret_string = "changeme"; /*This must be the same as in the wp-admin section if you want to manually refresh the cache
$secret_string = "changeme"; /*This is if you want to manually refresh the cache
ex: */
......@@ -24,7 +24,6 @@ $current_url = str_replace("?refresh=$secret_string", '', $current_url); //clea
$current_url = str_replace("&refresh=$secret_string", '', $current_url);
$redis_key = md5($current_url);
//Either manual refresh cache by adding ?refresh=secret_string after the URL or somebody posting a comment
if (isset($_GET['refresh']) || $_GET['refresh']==$secret_string || ($_SERVER['HTTP_REFERER'] == $current_url && $_SERVER['REQUEST_URI'] != '/' && $_SERVER['REMOTE_ADDR'] != $ip_of_your_website)) {
class wctest{
public function __construct(){
add_action('admin_menu', array($this, 'add_plugin_page'));
add_action('admin_init', array($this, 'page_init'));
public function add_plugin_page(){
// This page will be under "Settings"
add_options_page('Settings Admin', 'Settings', 'manage_options', 'test-setting-admin', array($this, 'create_admin_page'));
public function create_admin_page(){
<div class="wrap">
<?php screen_icon(); ?>
<form method="post" action="options.php">
// This prints out all hidden setting fields
<?php submit_button(); ?>
public function page_init(){
register_setting('test_option_group', 'array_key', array($this, 'check_ID'));
array($this, 'print_section_info'),
'Some ID(Title)',
array($this, 'create_an_id_field'),
public function check_ID($input){
$mid = $input['some_id'];
if(get_option('test_some_id') === FALSE){
add_option('test_some_id', $mid);
update_option('test_some_id', $mid);
$mid = '';
return $mid;
public function print_section_info(){
print 'Enter your setting below:';
public function create_an_id_field(){
?><input type="text" id="input_whatever_unique_id_I_want" name="array_key[some_id]" value="<?=get_option('test_some_id');?>" /><?php
$wctest = new wctest();
\ No newline at end of file
......@@ -2,7 +2,7 @@
Plugin Name: Wp Redis Cache
Plugin URI:
Description: Cache Wordpress with redis
Description: Cache Wordpress using Redis, the fastest way to date to cache Wordpress.
Version: 1.0
Author: Benjamin Adams
Author URI:
......@@ -36,16 +36,15 @@ function edit_redis_options() {
<h2>Wp-Redis Options</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p>This plugin does not work out of the box and requires additional steps. Please follow these install instructions: <a target='_blank' href=''></a></p>
<p>If you do not have Redis installed on your machine this will NOT work! </p>
<p><strong>Seconds of Caching:</strong><br />
How many seconds would you like to cache? *Recommended 12 hours or 43200 seconds <br />
<input type="text" name="wp-redis-cache-seconds" size="45" value="<?php echo get_option('wp-redis-cache-seconds'); ?>" /></p>
<p><strong>Secret String:</strong><br />
To refresh the cache of your post manually you will need to set a secret string so do can refresh manually like so:
<br /> <br />
<br />Important! You must change this in the index-wp-redis.php file<br />
<input type="text" name="wp-redis-secret" size="45" value="<?php echo get_option('wp-redis-secret'); ?>" /></p>
<p><input type="submit" name="Submit" value="Update Options" /></p>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment