safer to declare the cache global
(although it appears to have been working anyway?)