-

Welcome to cachings’s documentation!

+

caching package

caching (Caching Module)

Author:

@@ -172,7 +177,8 @@
class caching.property_cache_json(source_instance, cache_filename, load_all_on_init=False, callback_on_data_storage=None, max_age=None, store_on_get=True, return_source_on_none=False)
-

See also parent property_cache_pickle for detailed information.

+

Bases: property_cache_pickle

+

See also parent property_cache_pickle for detailed information.

Important

    @@ -269,31 +275,31 @@

    Will result on the first execution to the following output (with a long execution time):

    Testing property_cache (json):
     --------------------------------
    -2025-08-14 14:59:14,904:    DEBUG - caching - Cache file does not exists (yet).
    -2025-08-14 14:59:14,904:    DEBUG - caching - Loading property for key='1' from source instance
    +2025-08-15 00:39:57,193:    DEBUG - caching - Cache file does not exists (yet).
    +2025-08-15 00:39:57,193:    DEBUG - caching - Loading property for key='1' from source instance
     slow get executed for __1__
    -2025-08-14 14:59:17,905:    DEBUG - caching - Adding key=1, value=one with timestamp=1755176357 to chache
    -2025-08-14 14:59:17,906:    DEBUG - caching - cache-file stored (cache.json)
    +2025-08-15 00:40:00,194:    DEBUG - caching - Adding key=1, value=one with timestamp=1755211200 to chache
    +2025-08-15 00:40:00,195:    DEBUG - caching - cache-file stored (cache.json)
     one
    -2025-08-14 14:59:17,906:    DEBUG - caching - Loading property for key='2' from source instance
    +2025-08-15 00:40:00,195:    DEBUG - caching - Loading property for key='2' from source instance
     slow get executed for __2__
    -2025-08-14 14:59:20,907:    DEBUG - caching - Adding key=2, value=two with timestamp=1755176360 to chache
    -2025-08-14 14:59:20,907:    DEBUG - caching - cache-file stored (cache.json)
    +2025-08-15 00:40:03,195:    DEBUG - caching - Adding key=2, value=two with timestamp=1755211203 to chache
    +2025-08-15 00:40:03,197:    DEBUG - caching - cache-file stored (cache.json)
     two
    -2025-08-14 14:59:20,908:    DEBUG - caching - Loading property for key='three' from source instance
    +2025-08-15 00:40:03,197:    DEBUG - caching - Loading property for key='three' from source instance
     slow get executed for __three__
    -2025-08-14 14:59:23,908:    DEBUG - caching - Adding key=three, value=three with timestamp=1755176363 to chache
    -2025-08-14 14:59:23,909:    DEBUG - caching - cache-file stored (cache.json)
    +2025-08-15 00:40:06,197:    DEBUG - caching - Adding key=three, value=three with timestamp=1755211206 to chache
    +2025-08-15 00:40:06,198:    DEBUG - caching - cache-file stored (cache.json)
     three
    -2025-08-14 14:59:23,909:    DEBUG - caching - Loading property for key='four' from source instance
    +2025-08-15 00:40:06,198:    DEBUG - caching - Loading property for key='four' from source instance
     slow get executed for __four__
    -2025-08-14 14:59:26,910:    DEBUG - caching - Adding key=four, value=four with timestamp=1755176366 to chache
    -2025-08-14 14:59:26,911:    DEBUG - caching - cache-file stored (cache.json)
    +2025-08-15 00:40:09,199:    DEBUG - caching - Adding key=four, value=four with timestamp=1755211209 to chache
    +2025-08-15 00:40:09,200:    DEBUG - caching - cache-file stored (cache.json)
     four
    -2025-08-14 14:59:26,911:    DEBUG - caching - Loading property for key='five' from source instance
    +2025-08-15 00:40:09,200:    DEBUG - caching - Loading property for key='five' from source instance
     slow get executed for __five__
    -2025-08-14 14:59:29,911:    DEBUG - caching - Adding key=five, value=five with timestamp=1755176369 to chache
    -2025-08-14 14:59:29,912:    DEBUG - caching - cache-file stored (cache.json)
    +2025-08-15 00:40:12,201:    DEBUG - caching - Adding key=five, value=five with timestamp=1755211212 to chache
    +2025-08-15 00:40:12,202:    DEBUG - caching - cache-file stored (cache.json)
     five
     --------------------------------
     The execution time was 15.0s
    @@ -302,19 +308,19 @@
     

    With every following execution the time cosumption my by much smaller:

    Testing property_cache (json):
     --------------------------------
    -2025-08-14 14:59:30,025:    DEBUG - caching - Loading properties from cache (cache.json)
    -2025-08-14 14:59:30,025:    DEBUG - caching - Providing property for '1' from cache
    +2025-08-15 00:40:12,245:    DEBUG - caching - Loading properties from cache (cache.json)
    +2025-08-15 00:40:12,245:    DEBUG - caching - Providing property for '1' from cache
     one
    -2025-08-14 14:59:30,025:    DEBUG - caching - Providing property for '2' from cache
    +2025-08-15 00:40:12,245:    DEBUG - caching - Providing property for '2' from cache
     two
    -2025-08-14 14:59:30,025:    DEBUG - caching - Loading property for key='three' from source instance
    +2025-08-15 00:40:12,245:    DEBUG - caching - Loading property for key='three' from source instance
     slow get executed for __three__
    -2025-08-14 14:59:33,027:    DEBUG - caching - Adding key=three, value=three with timestamp=1755176373 to chache
    -2025-08-14 14:59:33,027:    DEBUG - caching - cache-file stored (cache.json)
    +2025-08-15 00:40:15,246:    DEBUG - caching - Adding key=three, value=three with timestamp=1755211215 to chache
    +2025-08-15 00:40:15,246:    DEBUG - caching - cache-file stored (cache.json)
     three
    -2025-08-14 14:59:33,028:    DEBUG - caching - Providing property for 'four' from cache
    +2025-08-15 00:40:15,247:    DEBUG - caching - Providing property for 'four' from cache
     four
    -2025-08-14 14:59:33,028:    DEBUG - caching - Providing property for 'five' from cache
    +2025-08-15 00:40:15,247:    DEBUG - caching - Providing property for 'five' from cache
     five
     --------------------------------
     The execution time was 3.0s
    @@ -325,7 +331,8 @@
     
    class caching.property_cache_pickle(source_instance, cache_filename, load_all_on_init=False, callback_on_data_storage=None, max_age=None, store_on_get=True, return_source_on_none=False)
    -

    This class caches the data from a given source_instance. It takes the data from the cache instead of generating the data from the source_instance, +

    Bases: object

    +

    This class caches the data from a given source_instance. It takes the data from the cache instead of generating the data from the source_instance, if the conditions for the cache usage are given.

    Required properties for the source_instance

    @@ -446,31 +453,31 @@ if the conditions for the cache usage are given.

    Will result on the first execution to the following output (with a long execution time):

    Testing property_cache (pickle):
     --------------------------------
    -2025-08-14 14:59:33,131:    DEBUG - caching - Cache file does not exists (yet).
    -2025-08-14 14:59:33,131:    DEBUG - caching - Loading property for key='1' from source instance
    +2025-08-15 00:40:15,331:    DEBUG - caching - Cache file does not exists (yet).
    +2025-08-15 00:40:15,331:    DEBUG - caching - Loading property for key='1' from source instance
     slow get executed for __1__
    -2025-08-14 14:59:36,133:    DEBUG - caching - Adding key=1, value=one with timestamp=1755176376 to chache
    -2025-08-14 14:59:36,133:    DEBUG - caching - cache-file stored (cache.pickle)
    +2025-08-15 00:40:18,331:    DEBUG - caching - Adding key=1, value=one with timestamp=1755211218 to chache
    +2025-08-15 00:40:18,332:    DEBUG - caching - cache-file stored (cache.pickle)
     one
    -2025-08-14 14:59:36,134:    DEBUG - caching - Loading property for key='2' from source instance
    +2025-08-15 00:40:18,332:    DEBUG - caching - Loading property for key='2' from source instance
     slow get executed for __2__
    -2025-08-14 14:59:39,134:    DEBUG - caching - Adding key=2, value=two with timestamp=1755176379 to chache
    -2025-08-14 14:59:39,135:    DEBUG - caching - cache-file stored (cache.pickle)
    +2025-08-15 00:40:21,333:    DEBUG - caching - Adding key=2, value=two with timestamp=1755211221 to chache
    +2025-08-15 00:40:21,334:    DEBUG - caching - cache-file stored (cache.pickle)
     two
    -2025-08-14 14:59:39,135:    DEBUG - caching - Loading property for key='three' from source instance
    +2025-08-15 00:40:21,334:    DEBUG - caching - Loading property for key='three' from source instance
     slow get executed for __three__
    -2025-08-14 14:59:42,136:    DEBUG - caching - Adding key=three, value=three with timestamp=1755176382 to chache
    -2025-08-14 14:59:42,136:    DEBUG - caching - cache-file stored (cache.pickle)
    +2025-08-15 00:40:24,335:    DEBUG - caching - Adding key=three, value=three with timestamp=1755211224 to chache
    +2025-08-15 00:40:24,335:    DEBUG - caching - cache-file stored (cache.pickle)
     three
    -2025-08-14 14:59:42,136:    DEBUG - caching - Loading property for key='four' from source instance
    +2025-08-15 00:40:24,336:    DEBUG - caching - Loading property for key='four' from source instance
     slow get executed for __four__
    -2025-08-14 14:59:45,137:    DEBUG - caching - Adding key=four, value=four with timestamp=1755176385 to chache
    -2025-08-14 14:59:45,138:    DEBUG - caching - cache-file stored (cache.pickle)
    +2025-08-15 00:40:27,336:    DEBUG - caching - Adding key=four, value=four with timestamp=1755211227 to chache
    +2025-08-15 00:40:27,337:    DEBUG - caching - cache-file stored (cache.pickle)
     four
    -2025-08-14 14:59:45,138:    DEBUG - caching - Loading property for key='five' from source instance
    +2025-08-15 00:40:27,338:    DEBUG - caching - Loading property for key='five' from source instance
     slow get executed for __five__
    -2025-08-14 14:59:48,138:    DEBUG - caching - Adding key=five, value=five with timestamp=1755176388 to chache
    -2025-08-14 14:59:48,139:    DEBUG - caching - cache-file stored (cache.pickle)
    +2025-08-15 00:40:30,338:    DEBUG - caching - Adding key=five, value=five with timestamp=1755211230 to chache
    +2025-08-15 00:40:30,340:    DEBUG - caching - cache-file stored (cache.pickle)
     five
     --------------------------------
     The execution time was 15.0s
    @@ -479,24 +486,54 @@ if the conditions for the cache usage are given.

    With every following execution the time cosumption my by much smaller:

    Testing property_cache (pickle):
     --------------------------------
    -2025-08-14 14:59:48,211:    DEBUG - caching - Loading properties from cache (cache.pickle)
    -2025-08-14 14:59:48,212:    DEBUG - caching - Providing property for '1' from cache
    +2025-08-15 00:40:30,387:    DEBUG - caching - Loading properties from cache (cache.pickle)
    +2025-08-15 00:40:30,387:    DEBUG - caching - Providing property for '1' from cache
     one
    -2025-08-14 14:59:48,212:    DEBUG - caching - Providing property for '2' from cache
    +2025-08-15 00:40:30,387:    DEBUG - caching - Providing property for '2' from cache
     two
    -2025-08-14 14:59:48,212:    DEBUG - caching - Loading property for key='three' from source instance
    +2025-08-15 00:40:30,387:    DEBUG - caching - Loading property for key='three' from source instance
     slow get executed for __three__
    -2025-08-14 14:59:51,212:    DEBUG - caching - Adding key=three, value=three with timestamp=1755176391 to chache
    -2025-08-14 14:59:51,213:    DEBUG - caching - cache-file stored (cache.pickle)
    +2025-08-15 00:40:33,388:    DEBUG - caching - Adding key=three, value=three with timestamp=1755211233 to chache
    +2025-08-15 00:40:33,388:    DEBUG - caching - cache-file stored (cache.pickle)
     three
    -2025-08-14 14:59:51,213:    DEBUG - caching - Providing property for 'four' from cache
    +2025-08-15 00:40:33,389:    DEBUG - caching - Providing property for 'four' from cache
     four
    -2025-08-14 14:59:51,214:    DEBUG - caching - Providing property for 'five' from cache
    +2025-08-15 00:40:33,389:    DEBUG - caching - Providing property for 'five' from cache
     five
     --------------------------------
     The execution time was 3.0s
     
    +
    +
    +AGE_TAG = '_age_'
    +
    + +
    +
    +DATA_TAG = '_data_'
    +
    + +
    +
    +DATA_VERSION_TAG = '_property_cache_data_version_'
    +
    + +
    +
    +STORAGE_VERSION = 1
    +
    + +
    +
    +STORAGE_VERSION_TAG = '_storage_version_'
    +
    + +
    +
    +UID_TAG = '_property_cache_uid_'
    +
    +
    add_source_get_keys(keys)
    @@ -543,16 +580,6 @@ and the resulting cache will be stored to the given file.

    -
    -
    -
-
-

Indices and tables

-
@@ -565,10 +592,16 @@ and the resulting cache will be stored to the given file.

Table of Contents

@@ -621,7 +653,7 @@ and the resulting cache will be stored to the given file.

caching documentation »