[1856] Decorators for locking threads and caching added.

https://gist.github.com/ArGroc/47a5a59eaea724a296d7