Main Content

mps.cache.Controller

Manage the life cycle of a persistence service in a MATLAB testing environment

Description

mps.cache.Controller is used to manage the life cycle of a persistence service in a MATLAB® testing environment. You can perform various actions such as starting and stopping the service using the object.

Creation

Create a mps.cache.Controller object using mps.cache.control.

Properties

expand all

This property is read-only.

Indicates whether the connection to the persistence provider is active or not. The value is True when the persistence service is attached to the MATLAB session, otherwise it is False.

Example: ActiveConnection: False

This property is read-only.

Indicates whether the controller object is managing the persistence service or not. ManageService is True if the persistence service is started using the controller's start method and False if the MATLAB session is attached to the persistence service using the controller's attach method. In all other cases, the value is set to Unknown.

If ManageService is True, destroying the controller object via delete or exiting MATLAB will stop the persistence service.

Example: ManageService: True

This property is read-only.

Name of the system hosting the persistence service.

This property is not displayed when you create a controller that uses MATLAB as a persistence provider.

Example: Host: 'localhost'

This property is read-only.

Port number for persistence service.

This property is not displayed when you create a controller that uses MATLAB as a persistence provider.

Example: Port: 4519

This property is read-only.

Name of the persistence provider.

Currently, Redis™ is the only supported persistence provider.

You can also use MATLAB as a persistence provider for testing purposes. If you use MATLAB as a persistence provider, the provider name is displayed as 'MatlabTest'.

Example: ProviderName: 'Redis'

Example: ProviderName: 'MatlabTest'

This property is read-only.

Name of connection to persistence service.

Example: ConnectionName: 'myRedisConnection'

This property is read-only.

Storage folder path. The folder displayed is used as a database.

* This property is displayed only when you create a controller that uses MATLAB as a persistence provider.

Example: Folder: 'c:\tmp'

Object Functions

mps.cache.controlCreate a persistence service controller object
startStart a persistence service and attach it to a MATLAB session
stopStop a persistence service and detach it from a MATLAB session
restartRestart a persistence service and attach it to a MATLAB session
attachConnect MATLAB session to persistence service that is already running
detachDisconnect MATLAB session from persistence service that is already running
pingTest whether the persistence service is reachable
versionVersion number for persistence provider

Examples

Create a Redis Service Controller

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

  Controller with properties:

    ActiveConnection: False
       ManageService: Unknown
                Host: 'localhost'
                Port: 4519
          Operations: "read | write | create | update"
        ProviderName: 'Redis'
      ConnectionName: 'myRedisConnection'

Create a MATLAB Service Controller

mctrl = mps.cache.control('myMATFileConnection','MatlabTest','Folder','c:\tmp') 
mctrl = 

  Controller with properties:

    ActiveConnection: False
       ManageService: Unknown
              Folder: 'c:\tmp'
          Operations: "read | write | create | update"
        ProviderName: 'MatlabTest'
      ConnectionName: 'myMATFileConnection'

Version History

Introduced in R2018b

See Also

Topics