sample code with cache