Main Content


Release advisory lock on persistence service mutex



TF = release(lk) releases an advisory lock on a persistence service mutex. If the lock expires before you release it, release returns a logical 0 (false). If this occurs, it may indicate potential data corruption.


collapse all

First, create a persistence service controller object and use that object to start the persistence service.

ctrl = mps.cache.control('myRedisConnection','Redis','Port',4519);

Use the connection name to create a persistence service mutex.

lk = mps.sync.mutex('myDbLock','Connection','myRedisConnection')

Try to acquire advisory lock. If lock is unavailable, retry acquiring for 20 seconds.

acquire(lk, 20);

Release lock.

TF = release(lk)
TF =



Input Arguments

collapse all

A persistence service specific mutex object. If you use Redis™ as your persistence provider, lk will be a mps.sync.TimedRedisMutex object. If you use a MATLAB® as your persistence provider, lk will be a mps.sync.TimedMATFileMutex object.

Output Arguments

collapse all

TF has a logical 1 (true) if releasing the advisory lock was successful, and a logical 0 (false) otherwise.

Version History

Introduced in R2018b