implement local cache