Roots Discourse

Use Redis cache with Bedrock and Trellis


#1

Hi,

I’m using this plugin for a woocommerce site:

But I’ve got some problems with the settings file that this plugin generates:
site/web/app/object-cache.php

The problem is that I don’t want this file to be checked in with git/version control because if I disable the plugin in local env and commit the file changes. The file will be considered to be deleted and then also be deleted on staging or production when I deploy.

So right now, after each deploy I have to check if the plugins is deactivated and also flush the redis cache each time. Because things like Product Attributes disappears when i deactivate redis cache.

I’m doing this wrong or do someone experienced the same issue?

Thanks for any kind of reply or help on this.

/Jonas


#2

@JulienMelissas and I use(d) https://wordpress.org/plugins/wp-redis/ . I don’t recall having that file change issue. Not sure how much that helps, I haven’t worked with wp-redis and an ecommerce site, so haven’t seen Product Attributes disappear, but nothing should break without using a cache. If you have to do something with each deploy, you should add some code into your trellis repo for it. For example, I have this for another obj cache plugin I used


then in group_vars/staging/wordpress_sites.yml in cache I would set wp_lcache: true if I wanted it. It looks like cache:

cache:
      enabled: true
      wp_lcache: false

#3

I’ve never had to deal with the file change issue, but my local .env (flywheel) has Redis built in, so I just use that.

Like @partounian said, nothing should break at all without the cache, so I honestly doubt a disabled cache plugin is the cause of things disappearing.