Redis
Last updated
Was this helpful?
Last updated
Was this helpful?
In this tutorial, we’ll create a Redis Data Capsule to provide low-latency, in-memory data storage for your application hosted on Code Capsules.
Log in to your and navigate to the Space your Redis Capsule will be contained in. Click the yellow +
button in the bottom left of the screen, select "New Capsule", then select "Redis" from the dropdown.
Choose a payment option, and click "Create Capsule".
Now we need to connect our Data Capsule to a Backend Capsule using a database connection URL.
Navigate to your Backend Capsule and click on the "Configure" tab. Scroll down to the "Data capsules" section and click "View". Click the +
next to the Connection string
variable to create a DATABASE_URL
environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
We'll use this environment variable in our app to connect to the Redis database.
If your Backend Capsule is a Python application, use the following code to connect to your Redis database:
If your Backend Capsule is a Node.js application, use the following code to connect to your Redis database:
If you’d like to deploy another application in a different language or framework, take a look at our other .