Add a LRU cache and use it for CachedFunction.

Fix #72.