Issue #1786490 by Berdir, amateescu, damiankloip, Wim Leers, dawehner: Add caching to the state system.