use a separate lock for the cache; this should improve performance significantly