MATLAB 帮助中心
本页采用了机器翻译。点击此处可查看最新英文版本。
连接到缓存,如果不存在则创建缓存
c = mps.cache.connect(cacheName)
c = mps.cache.connect(cacheName,'Connection',connectionName)
当与持久性服务有单一连接时,c = mps.cache.connect(cacheName) 连接到缓存。
c
cacheName
示例
c = mps.cache.connect(cacheName,'Connection',connectionName) 当与持久性服务有多个连接时,使用 connectionName 指定的连接连接到缓存。
connectionName
全部折叠
启动使用 Redis™ 作为持久性提供程序的持久性服务。该服务需要一个连接名称和一个开放端口。该服务运行后,您可以使用连接名称连接到该服务并创建缓存。
当您有一个连接时,您不需要向 mps.cache.connect 指定连接名称。
mps.cache.connect
ctrl = mps.cache.control('myRedisConnection','Redis','Port',4519) start(ctrl) c = mps.cache.connect('myCache');
c = RedisCache with properties: Host: 'localhost' Port: 4519 Name: 'myCache' Operations: "read | write | create | update" LocalKeys: {} Connection: 'myRedisConnection' Use getp instead of dot notation to access properties.
当您与持久性服务有多个连接时,请通过指定与要使用的服务关联的连接名称来创建缓存。
ctrl_1 = mps.cache.control('myRedisConnection1','Redis','Port',4519) start(ctrl_1) ctrl_2 = mps.cache.control('myRedisConnection2','Redis','Port',4520) start(ctrl_2) c = mps.cache.connect('myCache','Connection','myRedisConnection1')
c = RedisCache with properties: Host: 'localhost' Port: 4519 Name: 'myCache' Operations: "read | write | create | update" LocalKeys: {} Connection: 'myRedisConnection1' Use getp instead of dot notation to access properties.
要连接或创建的缓存名称,指定为字符向量。
示例: 'myCache'
'myCache'
与持久性服务的连接名称,指定为字符向量。
示例: 'Connection','myRedisConnection'
'Connection','myRedisConnection'
持久性提供程序特定的数据缓存对象。
目前,仅支持 Redis 和 MATLAB® 两个持久性提供程序。因此,缓存对象的类型将为 mps.cache.RedisCache 或 mps.cache.MATFileCache。
mps.cache.RedisCache
mps.cache.MATFileCache
在 R2018b 中推出
mps.cache.DataCache
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处