Backported lru_cache from python 3

Added minimal caching to pdanalyzer to improve processing speed on
phase diagrams with many entries at the same composition