mindspore2022/docs/api/api_python/dataset/mindspore.dataset.DatasetCa...

24 lines
1.8 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.dataset.DatasetCache
==============================
.. py:class:: mindspore.dataset.DatasetCache(session_id, size=0, spilling=False, hostname=None, port=None, num_connections=None, prefetch_size=None)
创建数据缓存客户端实例。
关于单节点数据缓存的使用,请参阅 `单节点数据缓存教程 <https://www.mindspore.cn/docs/programming_guide/zh-CN/master/enable_cache.html>`_
`单节点数据缓存编程指南 <https://www.mindspore.cn/docs/programming_guide/zh-CN/master/cache.html>`_
**参数:**
- **session_id** (int) - 当前数据缓存客户端的会话ID用户在命令行开启缓存服务端后可通过 `cache_admin -g` 获取。
- **size** (int, optional) - 设置数据缓存服务可用的内存大小。默认值0表示内存使用没有限制。
- **spilling** (bool, optional) - 如果共享内存不足是否将溢出部分缓存到磁盘。默认值False。
- **hostname** (str, optional) - 数据缓存服务客户端的主机IP。默认值None表示使用默认主机IP 127.0.0.1。
- **port** (int, optional) - 指定连接到数据缓存服务端的端口号。默认值None表示端口为50052。
- **num_connections** (int, optional) - TCP/IP连接数量。默认值None表示连接数量为12。
- **prefetch_size** (int, optional) - 指定缓存队列大小使用缓存功能算子时将直接从缓存队列中获取数据。默认值None表示缓存队列大小为20。
.. py:method:: get_stat()
获取缓存实例的统计信息。在数据管道结束后可获取三类统计信息包括平均缓存命中数avg_cache_sz内存中的缓存数num_mem_cached和磁盘中的缓存数num_disk_cached