implement caching functions