Shopware resources and help articles

Simple and to the point. Optimized by the community.

Configure REDIS Cache

6
by Thomas Holm Thomsen, last modified on February 20th, 2022

REDIS is an in-memory key-value store which can be used to hold the Shopware cache. REDIS is available via Symfony.

Dependency

Install the following REDIS package:

composer require predis/predis

REDIS CACHE

To set up REDIS for the cache, add this to the config/packages/framework.yaml file:

framework:
    cache:
        app: cache.adapter.redis
        system: cache.adapter.redis
        default_redis_provider: "redis://%env(REDIS_CACHE_HOST)%:%env(REDIS_CACHE_PORT)%/%env(REDIS_CACHE_DATABASE)%"

In your .env file add the following lines:

REDIS_CACHE_HOST="localhost"
REDIS_CACHE_PORT="6379"
REDIS_CACHE_DATABASE="0"

Where the REDIS_CACHE_DATABASE value corresponds to the database one wishes to use.

REDIS Commands

REDIS commands to check available databases:

# Total number of databases:
redis-cli CONFIG GET databases
# Currently used databases. Databases listed are taken:
redis-cli INFO keyspace
# Monitor REDIS activity:
redis-cli monitor
# Test REDIS connection. Result must be PONG:
redis-cli ping

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?