Caching array values locally