Implements caching using localStorage