This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mps.sync.TimedRedisMutex

Represent a Redis persistence service mutex

Description

mps.sync.TimedRedisMutex is a synchronization primitive used to protect data in a Redis™ persistence service from being simultaneously accessed by multiple workers.

Creation

Create a mps.sync.TimedRedisMutex object using mps.sync.mutex.

Properties

expand all

This property is read-only.

Duration of advisory lock in seconds.

Example: 10

This property is read-only.

Name of connection to persistence service.

Example: 'myRedisConnection'

This property is read-only.

Name of mutex, returned as a character vector.

Example: 'myMutex'

Object Functions

mps.sync.mutexCreate a persistence service mutex
acquireAcquire advisory lock on persistence service mutex
ownCheck ownership of advisory lock on a persistence service mutex object
releaseRelease advisory lock on persistence service mutex

Examples

Create a Redis Lock Object

ctrl = mps.cache.control('myRedisConnection','Redis','Port',4519);
start(ctrl)
lk = mps.sync.mutex('myMutex','Connection','myRedisConnection')
lk = 

  TimedRedisMutex with properties:

        Expiration: 10
    ConnectionName: 'myRedisConnection'
         MutexName: 'myMutex'

Introduced in R2018b