Avoid exception when entity_cache not enabled.
Merge pull request #5943 from openscholar/5896-cache

Avoid exception when entity_cache not enabled.