Cache decorator

https://gist.github.com/kszeluk/c11151345c66b6354221