Skip to content
A simple example of in-memory and Redis caching in Symfony 4
PHP HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
config
public
src
templates
tests
translations
.env
.env.test
.gitignore
README.md
composer.json
composer.lock
phpunit.xml.dist
symfony.lock

README.md

A simple example of in-memory and Redis caching in Symfony 4

Purpose

I made this project as part of a tutorial that describes how to implement caching in Symfony 4, both in-memory and with a Redis database.

NOTE: this project has only been tested on OSX.

Instructions

Prerequisites

A local installation of the Composer dependency manager.

Install dependencies

Navigate to the project root and run the following command:

composer install

Run the project using in-memory caching

Ensure that the cache section in the config/packages/cache.yaml file is commented out.

php bin/console server:run

Run the project using Redis caching

NOTE: you will need a Redis instance for this

Uncomment the section below "UNCOMMENT THIS SECTION......." in the config/packages/cache.yaml file, and alter redis://localhost:6379 so that it points at your Redis instance.

Navigate to the project root and run the following command:

php bin/console server:run
You can’t perform that action at this time.