extract code from scala cache doc
Merge pull request #1193 from XuefengWu/extract-code-scala-cache

extract code from scala cache doc