[ticket/9781] Disable search results caching if caching is actually disabled

https://tracker.phpbb.com/browse/PHPBB3-9781
Unrelated changes cause Sniffer issues.