Dirk Alders 3 months ago
parent
commit
9c48128b04

+ 4
- 12
__init__.py View File

55
                 * **data_version():** returns a version number of the current data (it should be increased, if the get method of the source instance returns improved values or the data structure had been changed).
55
                 * **data_version():** returns a version number of the current data (it should be increased, if the get method of the source instance returns improved values or the data structure had been changed).
56
                 * **get(key, default):** returns the property for a key. If key does not exists, default will be returned.
56
                 * **get(key, default):** returns the property for a key. If key does not exists, default will be returned.
57
     
57
     
58
-    .. hint:: You are able to use all parameters and methods of the `source_instance` identically with the property_cache instance.
59
-
60
     :param source_instance: The source instance holding the data
58
     :param source_instance: The source instance holding the data
61
     :type source_instance: instance
59
     :type source_instance: instance
62
     :param cache_filename: File name, where the properties are stored as cache
60
     :param cache_filename: File name, where the properties are stored as cache
143
         :param default: value to be returned, if key does not exists.
141
         :param default: value to be returned, if key does not exists.
144
         :returns: value for a given key or default value.
142
         :returns: value for a given key or default value.
145
         """
143
         """
146
-        if key in self.keys() and key not in self._source_get_keys:
144
+        if key in self._source_instance.keys() and key not in self._source_get_keys:
147
             if self._cached_props is None:
145
             if self._cached_props is None:
148
                 self._init_cache()
146
                 self._init_cache()
149
             if self._max_age is None:
147
             if self._max_age is None:
167
                 logger.debug("Providing property for '%s' from cache", key)
165
                 logger.debug("Providing property for '%s' from cache", key)
168
             return self._cached_props[self.DATA_TAG].get(self._key_filter(key), default)
166
             return self._cached_props[self.DATA_TAG].get(self._key_filter(key), default)
169
         else:
167
         else:
170
-            if key not in self.keys():
168
+            if key not in self._source_instance.keys():
171
                 logger.debug("Key '%s' is not in cached_keys. Uncached data will be returned.", key)
169
                 logger.debug("Key '%s' is not in cached_keys. Uncached data will be returned.", key)
172
             elif key in self._source_get_keys:
170
             elif key in self._source_get_keys:
173
                 logger.debug("Key '%s' is excluded by .add_source_get_keys(). Uncached data will be returned.", key)
171
                 logger.debug("Key '%s' is excluded by .add_source_get_keys(). Uncached data will be returned.", key)
229
     def _load_source(self, sleep_between_keys=0):
227
     def _load_source(self, sleep_between_keys=0):
230
         if self._cached_props is None:
228
         if self._cached_props is None:
231
             self._init_cache()
229
             self._init_cache()
232
-        logger.debug('Loading all data from source - %s', repr(self.keys()))
233
-        for key in self.keys():
230
+        logger.debug('Loading all data from source - %s', repr(self._source_instance.keys()))
231
+        for key in self._source_instance.keys():
234
             if key not in self._source_get_keys:
232
             if key not in self._source_get_keys:
235
                 self._cached_props[self.DATA_TAG][self._key_filter(key)] = self._source_instance.get(key)
233
                 self._cached_props[self.DATA_TAG][self._key_filter(key)] = self._source_instance.get(key)
236
                 self._cached_props[self.AGE_TAG][self._key_filter(key)] = int(time.time())
234
                 self._cached_props[self.AGE_TAG][self._key_filter(key)] = int(time.time())
249
         else:
247
         else:
250
             return self._cached_props.get(self.UID_TAG, None)
248
             return self._cached_props.get(self.UID_TAG, None)
251
 
249
 
252
-    def __getattribute__(self, name):
253
-        try:
254
-            return super().__getattribute__(name)
255
-        except AttributeError:
256
-            return getattr(self._source_instance, name)
257
-
258
 
250
 
259
 class property_cache_json(property_cache_pickle):
251
 class property_cache_json(property_cache_pickle):
260
     """
252
     """

BIN
_docs_/_downloads/f5f51665bfc67c10ccc039770b738067/unittest.pdf View File


+ 62
- 50
_docs_/index.html View File

238
         <span class="bp">self</span><span class="o">.</span><span class="n">print_n_sleep</span><span class="p">(</span><span class="s2">&quot;__five__&quot;</span><span class="p">)</span>
238
         <span class="bp">self</span><span class="o">.</span><span class="n">print_n_sleep</span><span class="p">(</span><span class="s2">&quot;__five__&quot;</span><span class="p">)</span>
239
         <span class="k">return</span> <span class="s1">&#39;five&#39;</span>
239
         <span class="k">return</span> <span class="s1">&#39;five&#39;</span>
240
 
240
 
241
+<span class="k">class</span> <span class="nc">test_slow_data_cached</span><span class="p">(</span><span class="n">test_slow_data</span><span class="p">):</span>
242
+    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
243
+        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
244
+        <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span> <span class="o">=</span> <span class="n">caching</span><span class="o">.</span><span class="n">property_cache_json</span><span class="p">(</span><span class="n">test_slow_data</span><span class="p">(),</span> <span class="s1">&#39;cache.json&#39;</span><span class="p">)</span>
245
+        <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span><span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">KEY_THREE</span><span class="p">)</span>
246
+
247
+    <span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
248
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">default</span><span class="p">)</span>
249
+
241
 
250
 
242
 <span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
251
 <span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
243
     <span class="c1"># Logging configuration</span>
252
     <span class="c1"># Logging configuration</span>
248
     <span class="p">)</span>
257
     <span class="p">)</span>
249
     <span class="c1"># Example</span>
258
     <span class="c1"># Example</span>
250
     <span class="n">tm</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
259
     <span class="n">tm</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
251
-    <span class="n">data</span> <span class="o">=</span> <span class="n">caching</span><span class="o">.</span><span class="n">property_cache_json</span><span class="p">(</span><span class="n">test_slow_data</span><span class="p">(),</span> <span class="s1">&#39;cache.json&#39;</span><span class="p">)</span>
252
-    <span class="n">data</span><span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">KEY_THREE</span><span class="p">)</span>
260
+    <span class="n">data</span> <span class="o">=</span> <span class="n">test_slow_data_cached</span><span class="p">()</span>
253
     <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Testing property_cache (json):</span><span class="se">\n</span><span class="s1">--------------------------------&#39;</span><span class="p">)</span>
261
     <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Testing property_cache (json):</span><span class="se">\n</span><span class="s1">--------------------------------&#39;</span><span class="p">)</span>
254
     <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
262
     <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
255
         <span class="nb">print</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">))</span>
263
         <span class="nb">print</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">))</span>
260
 <p>Will result on the first execution to the following output (with a long execution time):</p>
268
 <p>Will result on the first execution to the following output (with a long execution time):</p>
261
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Testing</span> <span class="n">property_cache</span> <span class="p">(</span><span class="n">json</span><span class="p">):</span>
269
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Testing</span> <span class="n">property_cache</span> <span class="p">(</span><span class="n">json</span><span class="p">):</span>
262
 <span class="o">--------------------------------</span>
270
 <span class="o">--------------------------------</span>
263
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">43</span><span class="p">,</span><span class="mi">744</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Cache</span> <span class="n">file</span> <span class="n">does</span> <span class="ow">not</span> <span class="n">exists</span> <span class="p">(</span><span class="n">yet</span><span class="p">)</span><span class="o">.</span>
264
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">43</span><span class="p">,</span><span class="mi">745</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
265
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">43</span><span class="p">,</span><span class="mi">745</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;1&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
271
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">08</span><span class="p">,</span><span class="mi">845</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Cache</span> <span class="n">file</span> <span class="n">does</span> <span class="ow">not</span> <span class="n">exists</span> <span class="p">(</span><span class="n">yet</span><span class="p">)</span><span class="o">.</span>
272
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">08</span><span class="p">,</span><span class="mi">846</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
273
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">08</span><span class="p">,</span><span class="mi">846</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;1&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
266
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__1__</span>
274
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__1__</span>
267
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">46</span><span class="p">,</span><span class="mi">746</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">one</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726956166</span> <span class="n">to</span> <span class="n">chache</span>
268
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">46</span><span class="p">,</span><span class="mi">747</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
275
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">11</span><span class="p">,</span><span class="mi">847</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">one</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726995671</span> <span class="n">to</span> <span class="n">chache</span>
276
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">11</span><span class="p">,</span><span class="mi">847</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
269
 <span class="n">one</span>
277
 <span class="n">one</span>
270
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">46</span><span class="p">,</span><span class="mi">748</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;2&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
278
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">11</span><span class="p">,</span><span class="mi">848</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;2&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
271
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__2__</span>
279
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__2__</span>
272
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">49</span><span class="p">,</span><span class="mi">749</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">two</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726956169</span> <span class="n">to</span> <span class="n">chache</span>
273
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">49</span><span class="p">,</span><span class="mi">750</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
280
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">14</span><span class="p">,</span><span class="mi">849</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">two</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726995674</span> <span class="n">to</span> <span class="n">chache</span>
281
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">14</span><span class="p">,</span><span class="mi">850</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
274
 <span class="n">two</span>
282
 <span class="n">two</span>
275
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">49</span><span class="p">,</span><span class="mi">751</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Key</span> <span class="s1">&#39;three&#39;</span> <span class="ow">is</span> <span class="n">excluded</span> <span class="n">by</span> <span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">()</span><span class="o">.</span> <span class="n">Uncached</span> <span class="n">data</span> <span class="n">will</span> <span class="n">be</span> <span class="n">returned</span><span class="o">.</span>
283
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">14</span><span class="p">,</span><span class="mi">850</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Key</span> <span class="s1">&#39;three&#39;</span> <span class="ow">is</span> <span class="n">excluded</span> <span class="n">by</span> <span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">()</span><span class="o">.</span> <span class="n">Uncached</span> <span class="n">data</span> <span class="n">will</span> <span class="n">be</span> <span class="n">returned</span><span class="o">.</span>
276
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__three__</span>
284
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__three__</span>
277
 <span class="n">three</span>
285
 <span class="n">three</span>
278
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">52</span><span class="p">,</span><span class="mi">752</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;four&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
286
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">17</span><span class="p">,</span><span class="mi">851</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;four&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
279
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__four__</span>
287
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__four__</span>
280
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">55</span><span class="p">,</span><span class="mi">754</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="n">four</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">four</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726956175</span> <span class="n">to</span> <span class="n">chache</span>
281
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">55</span><span class="p">,</span><span class="mi">755</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
288
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">20</span><span class="p">,</span><span class="mi">851</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="n">four</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">four</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726995680</span> <span class="n">to</span> <span class="n">chache</span>
289
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">20</span><span class="p">,</span><span class="mi">853</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
282
 <span class="n">four</span>
290
 <span class="n">four</span>
283
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">55</span><span class="p">,</span><span class="mi">755</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;five&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
291
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">20</span><span class="p">,</span><span class="mi">854</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;five&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
284
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__five__</span>
292
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__five__</span>
285
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">58</span><span class="p">,</span><span class="mi">757</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="n">five</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">five</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726956178</span> <span class="n">to</span> <span class="n">chache</span>
286
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">58</span><span class="p">,</span><span class="mi">758</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
293
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">23</span><span class="p">,</span><span class="mi">854</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="n">five</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">five</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726995683</span> <span class="n">to</span> <span class="n">chache</span>
294
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">23</span><span class="p">,</span><span class="mi">855</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
287
 <span class="n">five</span>
295
 <span class="n">five</span>
288
 <span class="o">--------------------------------</span>
296
 <span class="o">--------------------------------</span>
289
 <span class="n">The</span> <span class="n">execution</span> <span class="n">time</span> <span class="n">was</span> <span class="mf">15.0</span><span class="n">s</span>
297
 <span class="n">The</span> <span class="n">execution</span> <span class="n">time</span> <span class="n">was</span> <span class="mf">15.0</span><span class="n">s</span>
292
 <p>With every following execution the time cosumption my by much smaller:</p>
300
 <p>With every following execution the time cosumption my by much smaller:</p>
293
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Testing</span> <span class="n">property_cache</span> <span class="p">(</span><span class="n">json</span><span class="p">):</span>
301
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Testing</span> <span class="n">property_cache</span> <span class="p">(</span><span class="n">json</span><span class="p">):</span>
294
 <span class="o">--------------------------------</span>
302
 <span class="o">--------------------------------</span>
295
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">58</span><span class="p">,</span><span class="mi">825</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="n">properties</span> <span class="kn">from</span> <span class="nn">cache</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
296
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">58</span><span class="p">,</span><span class="mi">825</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;1&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
303
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">23</span><span class="p">,</span><span class="mi">983</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="n">properties</span> <span class="kn">from</span> <span class="nn">cache</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
304
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">23</span><span class="p">,</span><span class="mi">984</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;1&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
297
 <span class="n">one</span>
305
 <span class="n">one</span>
298
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">58</span><span class="p">,</span><span class="mi">825</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;2&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
306
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">23</span><span class="p">,</span><span class="mi">984</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;2&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
299
 <span class="n">two</span>
307
 <span class="n">two</span>
300
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">02</span><span class="p">:</span><span class="mi">58</span><span class="p">,</span><span class="mi">825</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Key</span> <span class="s1">&#39;three&#39;</span> <span class="ow">is</span> <span class="n">excluded</span> <span class="n">by</span> <span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">()</span><span class="o">.</span> <span class="n">Uncached</span> <span class="n">data</span> <span class="n">will</span> <span class="n">be</span> <span class="n">returned</span><span class="o">.</span>
308
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">23</span><span class="p">,</span><span class="mi">984</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Key</span> <span class="s1">&#39;three&#39;</span> <span class="ow">is</span> <span class="n">excluded</span> <span class="n">by</span> <span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">()</span><span class="o">.</span> <span class="n">Uncached</span> <span class="n">data</span> <span class="n">will</span> <span class="n">be</span> <span class="n">returned</span><span class="o">.</span>
301
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__three__</span>
309
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__three__</span>
302
 <span class="n">three</span>
310
 <span class="n">three</span>
303
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">01</span><span class="p">,</span><span class="mi">827</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;four&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
311
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">26</span><span class="p">,</span><span class="mi">984</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;four&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
304
 <span class="n">four</span>
312
 <span class="n">four</span>
305
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">01</span><span class="p">,</span><span class="mi">827</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;five&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
313
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">26</span><span class="p">,</span><span class="mi">985</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;five&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
306
 <span class="n">five</span>
314
 <span class="n">five</span>
307
 <span class="o">--------------------------------</span>
315
 <span class="o">--------------------------------</span>
308
 <span class="n">The</span> <span class="n">execution</span> <span class="n">time</span> <span class="n">was</span> <span class="mf">3.0</span><span class="n">s</span>
316
 <span class="n">The</span> <span class="n">execution</span> <span class="n">time</span> <span class="n">was</span> <span class="mf">3.0</span><span class="n">s</span>
324
 <li><p><strong>get(key, default):</strong> returns the property for a key. If key does not exists, default will be returned.</p></li>
332
 <li><p><strong>get(key, default):</strong> returns the property for a key. If key does not exists, default will be returned.</p></li>
325
 </ul>
333
 </ul>
326
 </div>
334
 </div>
327
-<div class="admonition hint">
328
-<p class="admonition-title">Hint</p>
329
-<p>You are able to use all parameters and methods of the <cite>source_instance</cite> identically with the property_cache instance.</p>
330
-</div>
331
 <dl class="field-list simple">
335
 <dl class="field-list simple">
332
 <dt class="field-odd">Parameters<span class="colon">:</span></dt>
336
 <dt class="field-odd">Parameters<span class="colon">:</span></dt>
333
 <dd class="field-odd"><ul class="simple">
337
 <dd class="field-odd"><ul class="simple">
409
         <span class="bp">self</span><span class="o">.</span><span class="n">print_n_sleep</span><span class="p">(</span><span class="s2">&quot;__five__&quot;</span><span class="p">)</span>
413
         <span class="bp">self</span><span class="o">.</span><span class="n">print_n_sleep</span><span class="p">(</span><span class="s2">&quot;__five__&quot;</span><span class="p">)</span>
410
         <span class="k">return</span> <span class="s1">&#39;five&#39;</span>
414
         <span class="k">return</span> <span class="s1">&#39;five&#39;</span>
411
 
415
 
416
+<span class="k">class</span> <span class="nc">test_slow_data_cached</span><span class="p">(</span><span class="n">test_slow_data</span><span class="p">):</span>
417
+    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
418
+        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
419
+        <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span> <span class="o">=</span> <span class="n">caching</span><span class="o">.</span><span class="n">property_cache_json</span><span class="p">(</span><span class="n">test_slow_data</span><span class="p">(),</span> <span class="s1">&#39;cache.pickle&#39;</span><span class="p">)</span>
420
+        <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span><span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">KEY_THREE</span><span class="p">)</span>
421
+
422
+    <span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
423
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">default</span><span class="p">)</span>
424
+
412
 
425
 
413
 <span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
426
 <span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
414
     <span class="c1"># Logging configuration</span>
427
     <span class="c1"># Logging configuration</span>
419
     <span class="p">)</span>
432
     <span class="p">)</span>
420
     <span class="c1"># Example</span>
433
     <span class="c1"># Example</span>
421
     <span class="n">tm</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
434
     <span class="n">tm</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
422
-    <span class="n">data</span> <span class="o">=</span> <span class="n">caching</span><span class="o">.</span><span class="n">property_cache_json</span><span class="p">(</span><span class="n">test_slow_data</span><span class="p">(),</span> <span class="s1">&#39;cache.json&#39;</span><span class="p">)</span>
423
-    <span class="n">data</span><span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">KEY_THREE</span><span class="p">)</span>
435
+    <span class="n">data</span> <span class="o">=</span> <span class="n">test_slow_data_cached</span><span class="p">()</span>
424
     <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Testing property_cache (pickle):</span><span class="se">\n</span><span class="s1">--------------------------------&#39;</span><span class="p">)</span>
436
     <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Testing property_cache (pickle):</span><span class="se">\n</span><span class="s1">--------------------------------&#39;</span><span class="p">)</span>
425
     <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
437
     <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
426
         <span class="nb">print</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">))</span>
438
         <span class="nb">print</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">))</span>
430
 <p>Will result on the first execution to the following output (with a long execution time):</p>
442
 <p>Will result on the first execution to the following output (with a long execution time):</p>
431
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Testing</span> <span class="n">property_cache</span> <span class="p">(</span><span class="n">pickle</span><span class="p">):</span>
443
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Testing</span> <span class="n">property_cache</span> <span class="p">(</span><span class="n">pickle</span><span class="p">):</span>
432
 <span class="o">--------------------------------</span>
444
 <span class="o">--------------------------------</span>
433
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">01</span><span class="p">,</span><span class="mi">889</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Cache</span> <span class="n">file</span> <span class="n">does</span> <span class="ow">not</span> <span class="n">exists</span> <span class="p">(</span><span class="n">yet</span><span class="p">)</span><span class="o">.</span>
434
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">01</span><span class="p">,</span><span class="mi">890</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
435
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">01</span><span class="p">,</span><span class="mi">890</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;1&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
445
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">126</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Cache</span> <span class="n">file</span> <span class="n">does</span> <span class="ow">not</span> <span class="n">exists</span> <span class="p">(</span><span class="n">yet</span><span class="p">)</span><span class="o">.</span>
446
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">127</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">pickle</span><span class="p">)</span>
447
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">27</span><span class="p">,</span><span class="mi">127</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;1&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
436
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__1__</span>
448
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__1__</span>
437
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">04</span><span class="p">,</span><span class="mi">891</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">one</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726956184</span> <span class="n">to</span> <span class="n">chache</span>
438
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">04</span><span class="p">,</span><span class="mi">891</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
449
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">128</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">one</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726995690</span> <span class="n">to</span> <span class="n">chache</span>
450
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">129</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">pickle</span><span class="p">)</span>
439
 <span class="n">one</span>
451
 <span class="n">one</span>
440
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">04</span><span class="p">,</span><span class="mi">892</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;2&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
452
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">129</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;2&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
441
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__2__</span>
453
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__2__</span>
442
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">07</span><span class="p">,</span><span class="mi">892</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">two</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726956187</span> <span class="n">to</span> <span class="n">chache</span>
443
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">07</span><span class="p">,</span><span class="mi">893</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
454
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">33</span><span class="p">,</span><span class="mi">130</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">two</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726995693</span> <span class="n">to</span> <span class="n">chache</span>
455
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">33</span><span class="p">,</span><span class="mi">131</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">pickle</span><span class="p">)</span>
444
 <span class="n">two</span>
456
 <span class="n">two</span>
445
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">07</span><span class="p">,</span><span class="mi">894</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Key</span> <span class="s1">&#39;three&#39;</span> <span class="ow">is</span> <span class="n">excluded</span> <span class="n">by</span> <span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">()</span><span class="o">.</span> <span class="n">Uncached</span> <span class="n">data</span> <span class="n">will</span> <span class="n">be</span> <span class="n">returned</span><span class="o">.</span>
457
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">33</span><span class="p">,</span><span class="mi">132</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Key</span> <span class="s1">&#39;three&#39;</span> <span class="ow">is</span> <span class="n">excluded</span> <span class="n">by</span> <span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">()</span><span class="o">.</span> <span class="n">Uncached</span> <span class="n">data</span> <span class="n">will</span> <span class="n">be</span> <span class="n">returned</span><span class="o">.</span>
446
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__three__</span>
458
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__three__</span>
447
 <span class="n">three</span>
459
 <span class="n">three</span>
448
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">10</span><span class="p">,</span><span class="mi">894</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;four&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
460
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">36</span><span class="p">,</span><span class="mi">133</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;four&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
449
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__four__</span>
461
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__four__</span>
450
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">13</span><span class="p">,</span><span class="mi">895</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="n">four</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">four</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726956193</span> <span class="n">to</span> <span class="n">chache</span>
451
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">13</span><span class="p">,</span><span class="mi">896</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
462
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">39</span><span class="p">,</span><span class="mi">134</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="n">four</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">four</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726995699</span> <span class="n">to</span> <span class="n">chache</span>
463
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">39</span><span class="p">,</span><span class="mi">135</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">pickle</span><span class="p">)</span>
452
 <span class="n">four</span>
464
 <span class="n">four</span>
453
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">13</span><span class="p">,</span><span class="mi">897</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;five&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
465
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">39</span><span class="p">,</span><span class="mi">136</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="nb">property</span> <span class="k">for</span> <span class="n">key</span><span class="o">=</span><span class="s1">&#39;five&#39;</span> <span class="kn">from</span> <span class="nn">source</span> <span class="n">instance</span>
454
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__five__</span>
466
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__five__</span>
455
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">16</span><span class="p">,</span><span class="mi">898</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="n">five</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">five</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726956196</span> <span class="n">to</span> <span class="n">chache</span>
456
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">16</span><span class="p">,</span><span class="mi">899</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
467
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">42</span><span class="p">,</span><span class="mi">136</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Adding</span> <span class="n">key</span><span class="o">=</span><span class="n">five</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">five</span> <span class="k">with</span> <span class="n">timestamp</span><span class="o">=</span><span class="mi">1726995702</span> <span class="n">to</span> <span class="n">chache</span>
468
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">42</span><span class="p">,</span><span class="mi">137</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">cache</span><span class="o">-</span><span class="n">file</span> <span class="n">stored</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">pickle</span><span class="p">)</span>
457
 <span class="n">five</span>
469
 <span class="n">five</span>
458
 <span class="o">--------------------------------</span>
470
 <span class="o">--------------------------------</span>
459
 <span class="n">The</span> <span class="n">execution</span> <span class="n">time</span> <span class="n">was</span> <span class="mf">15.0</span><span class="n">s</span>
471
 <span class="n">The</span> <span class="n">execution</span> <span class="n">time</span> <span class="n">was</span> <span class="mf">15.0</span><span class="n">s</span>
462
 <p>With every following execution the time cosumption my by much smaller:</p>
474
 <p>With every following execution the time cosumption my by much smaller:</p>
463
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Testing</span> <span class="n">property_cache</span> <span class="p">(</span><span class="n">pickle</span><span class="p">):</span>
475
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Testing</span> <span class="n">property_cache</span> <span class="p">(</span><span class="n">pickle</span><span class="p">):</span>
464
 <span class="o">--------------------------------</span>
476
 <span class="o">--------------------------------</span>
465
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">16</span><span class="p">,</span><span class="mi">978</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="n">properties</span> <span class="kn">from</span> <span class="nn">cache</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
466
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">16</span><span class="p">,</span><span class="mi">978</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;1&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
477
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">42</span><span class="p">,</span><span class="mi">204</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Loading</span> <span class="n">properties</span> <span class="kn">from</span> <span class="nn">cache</span> <span class="p">(</span><span class="n">cache</span><span class="o">.</span><span class="n">pickle</span><span class="p">)</span>
478
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">42</span><span class="p">,</span><span class="mi">204</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;1&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
467
 <span class="n">one</span>
479
 <span class="n">one</span>
468
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">16</span><span class="p">,</span><span class="mi">978</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;2&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
480
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">42</span><span class="p">,</span><span class="mi">205</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;2&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
469
 <span class="n">two</span>
481
 <span class="n">two</span>
470
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">16</span><span class="p">,</span><span class="mi">979</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Key</span> <span class="s1">&#39;three&#39;</span> <span class="ow">is</span> <span class="n">excluded</span> <span class="n">by</span> <span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">()</span><span class="o">.</span> <span class="n">Uncached</span> <span class="n">data</span> <span class="n">will</span> <span class="n">be</span> <span class="n">returned</span><span class="o">.</span>
482
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">42</span><span class="p">,</span><span class="mi">205</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Key</span> <span class="s1">&#39;three&#39;</span> <span class="ow">is</span> <span class="n">excluded</span> <span class="n">by</span> <span class="o">.</span><span class="n">add_source_get_keys</span><span class="p">()</span><span class="o">.</span> <span class="n">Uncached</span> <span class="n">data</span> <span class="n">will</span> <span class="n">be</span> <span class="n">returned</span><span class="o">.</span>
471
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__three__</span>
483
 <span class="n">slow</span> <span class="n">get</span> <span class="n">executed</span> <span class="k">for</span> <span class="n">__three__</span>
472
 <span class="n">three</span>
484
 <span class="n">three</span>
473
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">19</span><span class="p">,</span><span class="mi">980</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;four&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
485
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">45</span><span class="p">,</span><span class="mi">205</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;four&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
474
 <span class="n">four</span>
486
 <span class="n">four</span>
475
-<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">00</span><span class="p">:</span><span class="mi">03</span><span class="p">:</span><span class="mi">19</span><span class="p">,</span><span class="mi">981</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;five&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
487
+<span class="mi">2024</span><span class="o">-</span><span class="mi">09</span><span class="o">-</span><span class="mi">22</span> <span class="mi">11</span><span class="p">:</span><span class="mi">01</span><span class="p">:</span><span class="mi">45</span><span class="p">,</span><span class="mi">206</span><span class="p">:</span>    <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">caching</span> <span class="o">-</span> <span class="n">Providing</span> <span class="nb">property</span> <span class="k">for</span> <span class="s1">&#39;five&#39;</span> <span class="kn">from</span> <span class="nn">cache</span>
476
 <span class="n">five</span>
488
 <span class="n">five</span>
477
 <span class="o">--------------------------------</span>
489
 <span class="o">--------------------------------</span>
478
 <span class="n">The</span> <span class="n">execution</span> <span class="n">time</span> <span class="n">was</span> <span class="mf">3.0</span><span class="n">s</span>
490
 <span class="n">The</span> <span class="n">execution</span> <span class="n">time</span> <span class="n">was</span> <span class="mf">3.0</span><span class="n">s</span>

+ 1
- 1
_docs_/searchindex.js
File diff suppressed because it is too large
View File


+ 10
- 2
_examples_/property_cache_json.py View File

55
         self.print_n_sleep("__five__")
55
         self.print_n_sleep("__five__")
56
         return 'five'
56
         return 'five'
57
 
57
 
58
+class test_slow_data_cached(test_slow_data):
59
+    def __init__(self, *args, **kwargs) -> None:
60
+        super().__init__(*args, **kwargs)
61
+        self._cache = caching.property_cache_json(test_slow_data(), 'cache.json')
62
+        self._cache.add_source_get_keys(self.KEY_THREE)
63
+
64
+    def get(self, key, default=None):
65
+        return self._cache.get(key, default)
66
+
58
 
67
 
59
 if __name__ == "__main__":
68
 if __name__ == "__main__":
60
     # Logging configuration
69
     # Logging configuration
65
     )
74
     )
66
     # Example
75
     # Example
67
     tm = time.time()
76
     tm = time.time()
68
-    data = caching.property_cache_json(test_slow_data(), 'cache.json')
69
-    data.add_source_get_keys(data.KEY_THREE)
77
+    data = test_slow_data_cached()
70
     print('Testing property_cache (json):\n--------------------------------')
78
     print('Testing property_cache (json):\n--------------------------------')
71
     for key in data.keys():
79
     for key in data.keys():
72
         print(data.get(key))
80
         print(data.get(key))

+ 10
- 2
_examples_/property_cache_pickle.py View File

55
         self.print_n_sleep("__five__")
55
         self.print_n_sleep("__five__")
56
         return 'five'
56
         return 'five'
57
 
57
 
58
+class test_slow_data_cached(test_slow_data):
59
+    def __init__(self, *args, **kwargs) -> None:
60
+        super().__init__(*args, **kwargs)
61
+        self._cache = caching.property_cache_json(test_slow_data(), 'cache.pickle')
62
+        self._cache.add_source_get_keys(self.KEY_THREE)
63
+
64
+    def get(self, key, default=None):
65
+        return self._cache.get(key, default)
66
+
58
 
67
 
59
 if __name__ == "__main__":
68
 if __name__ == "__main__":
60
     # Logging configuration
69
     # Logging configuration
65
     )
74
     )
66
     # Example
75
     # Example
67
     tm = time.time()
76
     tm = time.time()
68
-    data = caching.property_cache_json(test_slow_data(), 'cache.json')
69
-    data.add_source_get_keys(data.KEY_THREE)
77
+    data = test_slow_data_cached()
70
     print('Testing property_cache (pickle):\n--------------------------------')
78
     print('Testing property_cache (pickle):\n--------------------------------')
71
     for key in data.keys():
79
     for key in data.keys():
72
         print(data.get(key))
80
         print(data.get(key))

+ 1224
- 1234
_testresults_/unittest.json
File diff suppressed because it is too large
View File


BIN
_testresults_/unittest.pdf View File


Loading…
Cancel
Save