From 7667ff6743e5dc980330f24fb48342029357fec8 Mon Sep 17 00:00:00 2001
From: Tamas Gal <tgal@km3net.de>
Date: Sun, 8 Mar 2020 23:16:12 +0100
Subject: [PATCH] Add cache

---
 km3io/offline.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/km3io/offline.py b/km3io/offline.py
index dba2525..b83eb25 100644
--- a/km3io/offline.py
+++ b/km3io/offline.py
@@ -503,7 +503,8 @@ class Usr:
             # which has a different strucuter and key (usr_data)
             # We do not support those...
             self._usr_names = [
-                n.decode("utf-8") for n in tree['usr_names'].lazyarray()[0]
+                n.decode("utf-8") for n in tree['usr_names'].lazyarray(
+                    basketcache=BASKET_CACHE)[0]
             ]
         except (KeyError, IndexError):  # e.g. old aanet files
             self._usr_names = []
@@ -665,8 +666,8 @@ class Branch:
         elif isinstance(self._index, int):
             return 1
         else:
-            return len(
-                self._branch[self._keymap['id']].lazyarray()[self._index])
+            return len(self._branch[self._keymap['id']].lazyarray(
+                basketcache=BASKET_CACHE)[self._index])
 
     def __str__(self):
         return "Number of elements: {}".format(len(self._branch))
-- 
GitLab