Reinstate Matthias' code partially so that the cache capacity can be
controlled from the graph configuration.