Implemented Python 3 functools.lru_cache as a class decorator compatible
with py2 and 3