Check that we can take a lock. Otherwise disable cache.
fix gh-932