Caching
Basics
This package automatically caches the results of all queries made to external resources. This includes the results of:
SPARQL queries (via the
endpoint_wrapper()
method).URI querying (via the
uri_querier()
method).DBpedia Lookup Linker requests (via the
dll_query_resolver()
method).DBpedia Spotlight requests (via the
spotlight_uri_extractor()
method).Checks for URL availability (via the
url_exists()
method).´
Note
As of now the size of the cache is and can not be limited. If you run into issues with regards of memory usage, try to clear the cache.
Usage
Disabling Caching
Caching can be manually disabling on a “per call” level by setting the caching
parameter of a cached method to False, as shown in the example below.
df_linked = label_linker(df, column='author', caching=False)
At the moment it is not possible to easily disable caching for all methods at once.
Checking the Cache Status
To check the status of the cache, call the show_cache_info()
method, as shown in the example below.
from kgextension.caching_helper import show_cache_info
show_cache_info()
Clearing the Cache
To clear the cache, call the clear_cache()
method, as shown in the example below.
from kgextension.caching_helper import clear_cache
clear_cache()