Redis stands for Remote Dictionary Server, and is an in-memory data structure store used as both a database and cache store.

Redis is known for its high performance, providing fast read and write operations, making it ideal for scenarios where quick access to data is crucial.

Setting Up Redis in RunCloud Docker

To set up Redis on RunCloud you’ll need to deploy a Redis container from the RunCloud Services section.

In your RunCloud dashboard, go to the Services section and check whether the Redis container is already running. If it isn’t, then simply click “Add to Stack” next to it, and then hit “Deploy“.

The above screenshot shows a successfully deployed Redis container.

Integrating Redis with WordPress on RunCloud

If you want to use Redis caching on your WordPress website, you can do it with only a few clicks using the RunCloud Hub plugin. Read our documentation on RunCloud Hub and Redis Object Caching to learn more.

Using Redis for General Applications

If you want to use Redis on something other than WordPress, then you can do this easily as well.

In this section, we have created an empty web application on RunCloud, and used the built-in file explorer to create a PHP file with the following code:

<?php
$redis = new Redis();
$redis->connect("host", 6379); 

$redis->set('org', 'RunCloud');
echo '<h1>', $redis->get('org'), '</h1>'; 
$redis->sadd('features', 'Painless Backup');
$redis->sadd('features', 'Automatic Firewall');
$redis->sadd('features', 'Simplified DNS Management');
$features = $redis->smembers('features');

echo "<ul>";
foreach ($features as $feature) {
    echo '<li>', $feature, '</li>';
}
echo "</ul>";

$redis->close();
?>

After adding the above code to a PHP file, saving it, and visiting its URL in a web browser, it should give an output similar to the following image:

That’s it! You have now enabled Redis on your RunCloud server, and you can use it to speed up your web applications.

If you’re building a custom web application in RunCloud Docker, we recommend reading about how RunCloud handles networking and firewall in Docker.