Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Redis overwriting cache for multiple sites

Status Resolved
Add-on / Version Speedy 1.9.0
Severity
EE Version 7.3.14

Hop Studios

Feb 21, 2024

Description of the problem

I have my site hosted on Nexcess, they gave me a Redis server. I am using the same Redis server for my staging and production environments.

It is resulting in overwriting of the cache files, i.e. when a page is cached at staging, the staging version is shown on the live site too.

I tried adding ‘prefix’ and ‘database’ parameters to the speedy_redis_settings under config of each environment, but that didn’t make any difference.

For the time being I have removed redis for staging and doing ‘file’ cache on it.

Is there any way to distinguish the cached files for different environments but same redis server?

How To Reproduce Steps to reproduce the behavior:

  1. Use same Redis server for 2 different sites
  2. Keep same paths and keys for the cached files
  3. View one of the site
  4. And see the same cached version on the other site.

Environment Details: - EE Version:7.3.14 - PHP Version 8.1.25

Possible Solution There is some settings to add in config for an environment, which adds some prefix to the cached files, either an extension that we can use before making the cache, add a prefix

Looking forward for your reposnse.

Thanks.

#1

BoldMinded (Brian)

What exactly is the issue?

#2

BoldMinded (Brian)

You left the html comments in the ticket template, so I didn’t see what you wrote until I edited and removed it.

#3

Hop Studios

Do you see the detail now?

#4

BoldMinded (Brian)

I would not recommend using the same Redis server for multiple environments. Your best option is to use a separate Redis instance for each environment.

#5

Hop Studios

Can we not add nay prefix there? I have only one Redis server provided by Nexcess.

#6

BoldMinded (Brian)

You can try adding a custom prefix to the key or url_prefix parameters. Make a global var or something, key=”{my_env}whatever”

#7

Hop Studios

Comment has been marked private.

#8

BoldMinded (Brian)

If you use the url_prefix option, which is really a general prefix option added for Publisher and Transcribe, it’ll add the prefix to whatever the current URL is, which sounds like you want to do. Though when the page is trying to load from the cache the prefix isn’t actually in the URL, so I’m not sure that’ll work now that I think of it.

I really recommend using separate Redis instances for each environment. It seems kind of sketch to me to share across all environments, especially for security reasons.

#9

Hop Studios

Comment has been marked private.

#10

BoldMinded (Brian)

Glad that worked out 😊

Login to reply