Commits

Ralph Bean committed 9bd0251

Configurable caching

  • Participants
  • Parent commits 4eb29c0

Comments (0)

Files changed (1)

tw2/rrd/widgets/core.py

         "rrdtool consolidation function to use.", default='AVERAGE')
     datasource_name = twc.Param(
         "rrdtool datasource name to use.", default='sum')
+    cache_data = twc.Param(
+        "Cache rrdfetch results in memory.", default=True)
 
     @classmethod
     def sanity(cls):
                     start=start_s,
                     end=end_s
                 )[cls.datasource_name]
-                # Cache it
-                _data_cache[filename] = results
-                _last_access[filename] = time.time()
+
+                if cls.cache_data:
+                    # Cache it
+                    _data_cache[filename] = results
+                    _last_access[filename] = time.time()
             else:
                 # Just get it from the cache
                 results = _data_cache[filename]