All or nothing synchronous lock for passed in keys. This method
together with filter check will be executed as one atomic operation.
If at least one filter validation failed, no locks will be acquired.
Locks are not transactional and should not be used from within transactions. If you do
need explicit locking within transaction, then you should use
TransactionConcurrency#PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.