Redis is a popular key-value database, well-regarded for its speed and simplicity. Platform.sh has offered a Redis service for quite some time, which is configured not to store data but to keep it only in memory. That makes it an excellent choice for a cache server, and we recommend that configuration for most projects.
Of course, Redis can do far more than caching. And we’re therefore happy to report we now offer a persistent configuration of Redis, too.
Available only for Redis 3, the new service is called redis-persistent
. (It seemed self-descriptive.) The only difference from the redis
service is that it is configured to store data permanently rather than toss data out when it runs out of memory (as a cache configuration would do). That also means data stored in Redis is replicated when an environment is branched, just like for MySQL, Elasticsearch, or MongoDB.
The configuration for redis-persistent
is essentially the same as any other service we offer. Simply add the following to your services.yaml
file:
redisdata:
type: "redis-persistent:3.0"
disk: 2048
That will give you a new service named redisdata
that will permanently store up to 2 GB of data. (Make sure your plan size has the space available). You can then expose that service to your applications in your relationships
block and access it exactly as you would an ephemeral redis
instance. Have a look at the updated documentation for more details and examples.
What can you do with a super-fast persistent key-value store? Anything you want. Let us know what you did with it.