Skip to content
Snippets Groups Projects
Commit f5b786ed authored by Christian Godenschwager's avatar Christian Godenschwager
Browse files

Allow to set cache directory via environment variable

parent 073d8d3c
No related merge requests found
import sympy as sp
import json
import os
try:
from functools import lru_cache as memorycache
......@@ -9,7 +10,11 @@ except ImportError:
try:
from joblib import Memory
from appdirs import user_cache_dir
diskcache = Memory(cachedir=user_cache_dir('pystencils'), verbose=False).cache
if 'PYSTENCILS_CACHE_DIR' in os.environ:
cacheDir = os.environ['PYSTENCILS_CACHE_DIR']
else:
cacheDir = user_cache_dir('pystencils')
diskcache = Memory(cachedir=cacheDir, verbose=False).cache
except ImportError:
# fallback to in-memory caching if joblib is not available
diskcache = memorycache(maxsize=64)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment