You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These factories perform basic caching of remote resources with minimal
configuration. There are currently three kinds:
* DictCachedSC2Factory - Caches results in memory with a dict. Uses an
optional argument `cache_max_size` which dumbly limits the number
of resources to cache in memory. Dict size is maintained by deleting
the least active entry at insert time when full. Resource size can
vary wildly at times; this factory does nothing to adjust for that.
* FileCachedSC2Factory - Cache results on disk in files. Requires your
configuration with a pre-existing `cache_dir` for writing files.
* DoubleCachedSC2Factory - Uses both of the above caching layers to
reduce IO time for commonly used resources. Order of operations:
1. try to load from DictCache and return.
2. try to load from FileCache, write to DictCache, and return.
3. Load remote resource, write to both caches and return.
Requires `cache_dir` and accepts an optional `cache_max_size` to
limit the DictCache size.
These caching schemes can be enabled painlessly by calling:
* sc2reader.useDictCache(cache_max_size=0, **SC2Factory_options)
* sc2reader.useFileCache(cache_dir, **SC2Factory_options)
* sc2reader.useDoubleCache(cache_dir, cache_max_size=0, **SC2Factory_options)
Thanks ggtracker for letting me push these utilties to the public repo.
0 commit comments