Skip to content

Commit bd9a416

Browse files
committed
try using tiled cache
1 parent bc36cb1 commit bd9a416

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/silx/io/tiledh5.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from . import commonh5
3535
import h5py
3636
import tiled.client
37+
from tiled.client.cache import Cache
3738

3839

3940
_logger = logging.getLogger(__name__)
@@ -83,6 +84,9 @@ class TiledH5(commonh5.File):
8384
Set to None for allowing an unbound number of children per group.
8485
"""
8586

87+
_cache = None
88+
"""Shared tiled cache with lazy initialization"""
89+
8690
def __init__(
8791
self,
8892
name: str,
@@ -91,7 +95,9 @@ def __init__(
9195
):
9296
assert mode in ("r", None)
9397
super().__init__(name, mode, attrs)
94-
self.__container = tiled.client.from_uri(name)
98+
if self._cache is None:
99+
TiledH5._cache = Cache() # Use tiled cache default
100+
self.__container = tiled.client.from_uri(name, cache=self._cache)
95101
assert isinstance(self.__container, tiled.client.container.Container)
96102

97103
def close(self):

0 commit comments

Comments
 (0)