MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / cachedQuery

Function cachedQuery

eos/db/gamedata/queries.py:34–52  ·  view source on GitHub ↗
(amount, *keywords)

Source from the content-addressed store, hash-verified

32configVal = getattr(eos.config, "gamedataCache", None)
33if configVal is True:
34 def cachedQuery(amount, *keywords):
35 def deco(function):
36 def checkAndReturn(*args, **kwargs):
37 useCache = kwargs.pop("useCache", True)
38 cacheKey = []
39 cacheKey.extend(args)
40 for keyword in keywords:
41 cacheKey.append(kwargs.get(keyword))
42
43 cacheKey = tuple(cacheKey)
44 handler = cache.get(cacheKey)
45 if handler is None or not useCache:
46 handler = cache[cacheKey] = function(*args, **kwargs)
47
48 return handler
49
50 return checkAndReturn
51
52 return deco
53
54elif callable(configVal):
55 cachedQuery = eos.config.gamedataCache

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected