Extracted java cache sample code from docs