rdf_cache.pl -- Cache RDF triples
The library library(semweb/rdf_cache) defines the caching strategy for triples sources. When using large RDF sources, caching triples greatly speedup loading RDF documents. The cache library implements two caching strategies that are controlled by rdf_set_cache_options/1.
Local caching This approach applies to files only. Triples are
cached in a sub-directory of the directory holding the source. This
directory is called .cache
(_cache
on Windows). If the cache
option create_local_directory
is true
, a cache directory is created
if posible.
Global caching This approach applies to all sources, except for
unnamed streams. Triples are cached in directory defined by the cache
option global_directory
.
When loading an RDF file, the system scans the configured cache files
unless cache(false)
is specified as option to rdf_load/2 or caching is
disabled. If caching is enabled but no cache exists, the system will try
to create a cache file. First it will try to do this locally. On failure
it will try to configured global cache.
- rdf_set_cache_options(+Options)
- Change the cache policy. Provided options are:
enabled(Boolean)
Iftrue
, caching is enabled.local_directory(Name)
. Plain name of local directory. Default.cache
(_cache
on Windows).create_local_directory(Bool)
Iftrue
, try to create local cache directoriesglobal_directory(Dir)
Writeable directory for storing cached parsed files.create_global_directory(Bool)
Iftrue
, try to create the global cache directory.
- rdf_cache_file(+URL, +ReadWrite, -File) is semidet
- File is the cache file for URL. If ReadWrite is
read
, it returns the name of an existing file. Ifwrite
it returns where a new cache file can be overwritten or created.