Using a Redis Server as your Laravel Cache Storage

Using a Redis Server as your Laravel Cache Storage

Friday, 28th March

What is redis?

As they state on the website:
Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

Now that we know what is it, lets talk about installing it.

Installing Redis Database
We are going to install Redis on Ubuntu 12.04 64x server, so simply lets update our server first:

sudo -s
apt-get update && apt-get -y upgrade

And to be honest, I am a lazy person, when I found something useful I used it instead of doing it myself, for this I found a nice bash script written for Vaprobash, which install Redis on by doing everything for me, so am going to use this simple script like this:

sudo -s

and in a few second the installation will finish and we can check that Redis has been installed successfully using the command `ping` like:

redis-cli ping

and the answer should be


Now you can use the command `redis-cli` to execute/communicate with the Redis server, the commands page list all of the commands which we can use to interact with Redis server.

Configure Laravel cache
Laravel has a simple way to configure the cache driver which you want to use, its as simple as changing a small option within the config file `app/config/cahce.php` this option called `driver`, this option can take one of many values:


You can check the documentation for Laravel cache configuration at

So to use Redis we should change the default driver option from `file` to `redid` and thats it, if they are on the same server you don't need to do anything, but if you plan to use it on its own server you should continue reading.

Configure Redis to allow outside connections
Normally Redis is configured to allow connections from the local IP address ``, so we need to change this to accept any connection by editing `redis.conf` file like:

sudo -s
nano /etc/redis/redis.conf

Now lets change this small line from bind to bind

We can just comment out the old line to keep it for later modification by just adding `#` to it so that the final code will look like:


Using Visual GUI
Redis severs like any other *nix servers does not have any GUI to manage it, but thank to the OSS Community I have found a nice GUI desktop application called Redis Desktop Manager, which works on windows,mac and linux desktops.