First caching function implementation