Fix cache generation condition

If it's ok, I have to change the condition in my Null Object PR