README.md 1.95 KB
Newer Older
Benjamin Adams's avatar
Benjamin Adams committed
1
## Wp Redis Cache
2
------
Benjamin Adams's avatar
Benjamin Adams committed
3
Cache Wordpress using Redis, the fastest way to date to cache Wordpress.
Benjamin Adams's avatar
Benjamin Adams committed
4

Benjamin Adams's avatar
Benjamin Adams committed
5
6
7
8
9
### Requirements
------
[Wordpress](http://wordpress.org) - CMS framework/blogging system
[Redis](http://redis.io/) - Key Value in memory caching
[Predis](https://github.com/nrk/predis) - PHP api for Redis
Benjamin Adams's avatar
Benjamin Adams committed
10

Benjamin Adams's avatar
Benjamin Adams committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
### Setup
------
Install Redis, must have root access to your machine. On debian it's as simple as:
```bash
sudo apt-get install redis-server
```
On other systems please refer to the [Redis website](http://redis.io/).

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:
```php
<?php
26
27
require('index-wp-redis.php');
?>
Benjamin Adams's avatar
Benjamin Adams committed
28
```
29
30
In `index-wp-redis.php` change `$ip_of_your_website` to the IP of your server

Benjamin Adams's avatar
Benjamin Adams committed
31
32
33
34
35
36
37
38
*Note: Sometimes when you upgrade Wordpress it will replace over your `index.php` file and you will have to redo this step.  This is the reason we don't just replace the contents of `index-wp-redis.php` with `index.php`.

We do this because Wordpress is no longer in charge of displaying our posts.  Redis will now server the post if it is in the cache.  If the post is not in the Redis cache it will then call Wordpress to serve the page and then cache it for the next pageload


### Benchmark
------
I welcome you to compare the page load times of this caching system with other popular Caching plugins such as [Wp Super Cache](http://wordpress.org/plugins/wp-super-cache/) and [W3 Total Cache](http://wordpress.org/plugins/w3-total-cache/)
Benjamin Adams's avatar
Benjamin Adams committed
39

Benjamin Adams's avatar
Benjamin Adams committed
40
With a fresh Wordpress install:
41

Benjamin Adams's avatar
Benjamin Adams committed
42
43
44
45
46
47
48
49
50
51
52
53
54
Wp Super Cache
```
Page generated in 0.318 seconds.
```

W3 Total Cache
```
Page generated in 0.30484 seconds.
```

Wp Redis Cache
```
Page generated in 0.00902 seconds.
Benjamin Adams's avatar
Benjamin Adams committed
55
56
```