diff options
| author | Lex Neva <github.com@lexneva.name> | 2022-07-29 18:17:50 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2023-02-18 22:34:47 -0500 |
| commit | 98bc2e2ff9c843a64c3db355290ed541e6708312 (patch) | |
| tree | 593edf118780f9902437a306323595c6846acb24 /lib/utils/cache.py | |
| parent | a0834e2e7c2f2b6734877a8ee922c01e8c9330ba (diff) | |
add preferences UI including cache settings
Diffstat (limited to 'lib/utils/cache.py')
| -rw-r--r-- | lib/utils/cache.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/utils/cache.py b/lib/utils/cache.py index 767978ca..1ede8ce1 100644 --- a/lib/utils/cache.py +++ b/lib/utils/cache.py @@ -10,6 +10,8 @@ import pickle import appdirs import diskcache +from lib.utils.settings import global_settings + try: from functools import lru_cache except ImportError: @@ -29,7 +31,9 @@ def get_stitch_plan_cache(): if __stitch_plan_cache is None: cache_dir = os.path.join(appdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan') - __stitch_plan_cache = diskcache.Cache(cache_dir, size=1024 * 1024 * 100) + size_limit = global_settings['cache_size'] * 1024 * 1024 + __stitch_plan_cache = diskcache.Cache(cache_dir, size=size_limit) + __stitch_plan_cache.size_limit = size_limit atexit.register(__stitch_plan_cache.close) return __stitch_plan_cache |
