We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ngd
Current implementation of NGD caches is in https://github.com/biothings/pending.api/blob/master/web/utils/cache.py. It's made due to that functools.lru_cache cannot decorate async def functions.
functools.lru_cache
async def
cachetools
Is cachetools.LRUCache faster than our vanilla implementation?
cachetools.LRUCache
cachetools provided the following types of caches:
cachetools.FIFOCache
cachetools.LFUCache
cachetools.MRUCache
cachetools.RRCache
random.choice()
cachetools.TTLCache
cachetools.TLRUCache
Which type works best for NGD?
All the above cache classes are not thread-safe. However, cachetools provides thread-safe decorators; see cachetools.func - functools.lru_cache() compatible decorators.
cachetools.func
functools.lru_cache()
Since we are using corotines, thread-safety is not an issue so far.
The text was updated successfully, but these errors were encountered:
Referring to the endpoint https://biothings.ci.transltr.io/semmeddb/query/ngd. Isn't documented in the pending.api example queries, but is found on the smartapi listing
Sorry, something went wrong.
Pertinent bte issues as well
everaldorodrigo
ctrl-schaff
No branches or pull requests
Status Quo
Current implementation of NGD caches is in https://github.com/biothings/pending.api/blob/master/web/utils/cache.py. It's made due to that
functools.lru_cache
cannot decorateasync def
functions.Alternative:
cachetools
Performance Comparison
Is
cachetools.LRUCache
faster than our vanilla implementation?Which type is best for the NGD scenario?
cachetools
provided the following types of caches:cachetools.FIFOCache
: First In First Outcachetools.LFUCache
: Least Frequently Used (will be discarded)cachetools.LRUCache
: Least Recently Used (will be discarded)cachetools.MRUCache
: Most Recently Used (will be discarded)cachetools.RRCache
: Random Replacement (item selected byrandom.choice()
)cachetools.TTLCache
: LRU Cache with per-item time-to-live (TTL)cachetools.TLRUCache
: Time-aware LRU; similar tocachetools.TTLCache
but the TTL calculation can be customizedWhich type works best for NGD?
Side Note:
cachetools
thread-safetyAll the above cache classes are not thread-safe. However,
cachetools
provides thread-safe decorators; seecachetools.func
-functools.lru_cache()
compatible decorators.Since we are using corotines, thread-safety is not an issue so far.
The text was updated successfully, but these errors were encountered: