extract code from scala cache doc