Main Content

getp

Get the value of a public cache property

Description

value = getp(c,property) gets the value of a public cache property.

Ordinarily, you would be able to access the public properties of a cache object using the dot notation. For example: c.Connection. However, all cache objects use dot reference and dot assignment to refer to keys stored in the cache rather than cache object properties. Therefore, c.Connection refers to a key named Connection in the cache instead of the cache's Connection property.

There is no setp method since all cache properties are read-only.

example

Examples

collapse all

Start a persistence service that uses Redis™ as the persistence provider. The service requires a connection name and an open port. Once the service is running, you can connect to the service using the connection name and create a cache.

ctrl = mps.cache.control('myRedisConnection','Redis','Port',4519);
start(ctrl)
c = mps.cache.connect('myCache', 'Connection', 'myRedisConnection');

Retrieve the connection name.

getp(c,'Connection')
ans =

    'myRedisConnection'

Input Arguments

collapse all

A data cache represented by a persistence provider specific data cache object.

Currently, Redis and MATLAB® are the only supported persistence providers. Therefore, the cache objects will be of type mps.cache.RedisCache or mps.cache.MATFileCache.

Example: c

Property name, specified as a character vector. The common public cache properties are Name, LocalKeys, and Connection. Provider-specific cache objects may have additional properties. For example, mps.cache.RedisCache has the properties Host and Port.

Example: 'Connection'

Output Arguments

collapse all

A valid property value.

Version History

Introduced in R2018b

See Also

| |