Articles in this section

How to set up a redis cache?

To add a Redis service to your project, add an entry to your project's services.yaml file. 
We support two Redis modes:

  • Persistent: to set up fast persistent storage for your application, use the type redis-persistent
  • Ephemeral: to set up a non-persistent cache for your application, use the type  redis.

By default, Redis is ephemeral. This allows for fast data retrieval, but also means data can be lost when a container is moved or shut down.

 

Configuration example:

.upsun/config.yaml
applications:
  # The name of the app container. Must be unique within a project.
  <APP_NAME>:
    source:
      root: "myapp"

    # PHP extensions.
    runtime:
      extensions:
        - redis

    [...]

    # Relationships enable access from this app to a given service.
    # The example below shows simplified configuration leveraging a default service
    # (identified from the relationship name) and a default endpoint.
    # See the Application reference for all options for defining relationships and endpoints.
    relationships:
      redis:
services:
  # The name of the service container. Must be unique within a project.
  redis:
    type: redis-persistent:8.0

This configuration defines a single application (myapp), whose source code exists in the <PROJECT_ROOT>/myapp directory.
myapp has access to the redis service, via a relationship whose name is identical to the service name (as per default endpoint configuration for relationships).

 

 

 

 

For more information on this feature, please see the following page in the Upsun documentation:

https://docs.upsun.com/add-services/redis.html 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.