Merge pull request #2324 from akoeplinger/caching-locking