ISPN-4559 Replace fails with cache loader

https://issues.jboss.org/browse/ISPN-4559
https://issues.jboss.org/browse/ISPN-4649
I changed the if. Only the write commands needs special treatment.