custom caching function
add logging