added caching and locking
added cache test
modified cache test
Merge pull request #7 from mjelonek92/bug_3128

[3128] Caching.