Add a cache of refs for a Tree.

TODO:

- [x] wait for #95 
- [ ] wait for #39
- [ ] research caching options:
    - [ ] https://docs.python.org/3.4/library/linecache.html
    - [ ] http://pythonhosted.org//pyfscache/