Decision Use identical cache backends on development environments
acceptedUsing memory caches like Memcached or Redis in production but not in development environments can lead to bugs and confusion.
Decision
Development environments (like Tugboat) will use the same cache backend as production environments. Local environments will also use the same backend.
Using different cache backends on non-production environments can lead to tricky bugs that are hard to diagnose. For example:
- When production environments change cache backends, such as from database caching to a memory cache, it is possible for stale entries to be left in the database. These entries may cause unexpected behaviour on other environments if they are still using the default database backend.
- Automated tests may miss production bugs if the bug only occurs when using a memory cache backend.
Projects using ddev should use ddev-memcached or ddev-redis to add the appropriate cache server.
Tugboat images for both Memcached and Redis are also available.
Consequences
All environments will be more consistent with each other, reducing the chances of "it only happens in production" bugs.
Developers working on local environments may be surprised to not see cache entries in the database. Inspecting caches with database tools like PHPStorm's database viewer is simpler than inspecting Memcached or Redis contents. They will need to become familiar with Drush's cache:get command.