From 9d9a7cf2b507fc4d0d4939b1dc35b48b8c9abbf1 Mon Sep 17 00:00:00 2001
From: Thor77 <thor77@thor77.org>
Date: Thu, 1 Feb 2018 21:37:53 +0100
Subject: [PATCH] Add cached_files-property to Cache

to easily access store-keys without unwanted 'version'-key
---
 tsstats/cache.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tsstats/cache.py b/tsstats/cache.py
index 4c244df..3cca470 100644
--- a/tsstats/cache.py
+++ b/tsstats/cache.py
@@ -95,6 +95,12 @@ class Cache(MutableMapping):
             return True
         return _calculate_hash(path) != self.store[path].hash
 
+    @property
+    def cached_files(self):
+        store_keys = list(self.store.keys())
+        store_keys.remove('version')
+        return store_keys
+
     def __setitem__(self, path, events):
         self.store[path] = CachedLog(path, _calculate_hash(path), list(events))
         self.store['version'] += 1
@@ -106,7 +112,7 @@ class Cache(MutableMapping):
         del self.store[path]
 
     def __iter__(self):
-        return iter(self.store.keys() - ['version'])
+        return iter(self.cached_files)
 
     def __len__(self):
-        return len(self.store.keys() - ['version'])
+        return len(self.cached_files)