better solution

better style (remove extra brackets and etc.)
use OrderedDict in cache(func, cache-size) function