From f82c450f23b866b3966c9b13fab5bd0b75add501 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Mon, 13 May 2024 16:47:10 +0200 Subject: [PATCH] try using tiled cache --- src/silx/io/tiledh5.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/silx/io/tiledh5.py b/src/silx/io/tiledh5.py index ffbdd8b786..4bd2c8dea3 100644 --- a/src/silx/io/tiledh5.py +++ b/src/silx/io/tiledh5.py @@ -34,6 +34,7 @@ from . import commonh5 import h5py import tiled.client +from tiled.client.cache import Cache _logger = logging.getLogger(__name__) @@ -83,6 +84,9 @@ class TiledH5(commonh5.File): Set to None for allowing an unbound number of children per group. """ + _cache = None + """Shared tiled cache with lazy initialization""" + def __init__( self, name: str, @@ -91,7 +95,9 @@ def __init__( ): assert mode in ("r", None) super().__init__(name, mode, attrs) - self.__container = tiled.client.from_uri(name) + if self._cache is None: + TiledH5._cache = Cache() # Use tiled cache default + self.__container = tiled.client.from_uri(name, cache=self._cache) assert isinstance(self.__container, tiled.client.container.Container) def close(self):