从缓存相关错误中保护symfony生产环境的方法

Okay, might sounds little like a troll but it's not. Since I started to programming with symfony, I encountered very very very weird bugs. Like 3 times in a month. That was always related to my caching files and every time, I spent hours to finally figure it out it was coming from him.

I'm working on a project with cryptography, and when my dear symfony start to forget the keys between two encryption with the same key : I've start to freaked out about the future of my web application. (the real bug is to weird that I can't really explain it)

I am going to store sensitive data and I can't imagine some of this things append in production and all I can say is since I've cleared AND remove my cache folder, the bug disappear. What a trusting behaviour !

So, are those weird bug only related to development environment due to the large amount of file update ?

What is your context to tell you that you need to clear your cache in development environment ?

Should I deactivate all kind of cache for the production environment to guarantee that will not happen again ?

Thank you guys.

  1. Think 3 time, before you decide to disable cache on prod. It's probably a bad idea.
  2. On dev if you modify bundles, some config, etc, sometimes Symfony fails to refresh cache, and to be sure that errors you receive are real you should delete whole app cache and clear memcached/redis if you use it.
  3. On production you probably will/should create new directory with clean fresh version of your app with clean cache and then you replace your old revision with new one (usually by changing the symlink). Thats why if your app works on dev with clean cache it should be ok on prod env.