Skip to content
Snippets Groups Projects
Commit cf9f3415 authored by Martin Bauer's avatar Martin Bauer
Browse files

Moved cache functionality from lbmpy to pystencils

parent fd2df06b
No related merge requests found
cache.py 0 → 100644
try:
from functools import lru_cache as memorycache
except ImportError:
from backports.functools_lru_cache import lru_cache as memorycache
try:
from joblib import Memory
diskcache = Memory(cachedir="/tmp/lbmpy", verbose=False).cache
except ImportError:
# fallback to in-memory caching if joblib is not available
diskcache = memorycache(maxsize=64)
# joblibs Memory decorator does not play nicely with sphinx autodoc (decorated functions do not occur in autodoc)
# -> if this script is imported by sphinx we use functools instead
import sys
calledBySphinx = 'sphinx' in sys.modules
if calledBySphinx:
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