Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two apps share one Redis. How to prevent cache collisions?

Two different versions of the application (debug and release) share same instance of Redis. Both Debug and Release have identical source code and therefore identical caching keys for being stored in Redis.

enter image description here

Thus when Debug does redis.StringSet(key1, value1) Release could easily overwrite key1 or read incorrect value (since it should have its own key1).

Is there a way to avoid such interference?

like image 508
Ivan Studenikin Avatar asked Oct 12 '25 19:10

Ivan Studenikin


1 Answers

Do not do that - sharing is bad. Spin a Redis instance per environment, each server has negligible overhead.

like image 159
Itamar Haber Avatar answered Oct 14 '25 13:10

Itamar Haber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!