RequireJS Publisher: add lock around cache operations

The current implementation uses giant lock around all cache operations.
It should refactored to fine grained lock.