Backport for #3882, honor query cache config

Backport: https://github.com/hazelcast/hazelcast/pull/4170