% This LaTeX document was generated using the LaTeX backend of PlDoc, % The SWI-Prolog documentation system \subsection{library(semweb/rdf_cache): Cache RDF triples} \label{sec:rdfcache} The library \file{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 \predref{rdf_set_cache_options}{1}. \textbf{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 \verb$.cache$ (\verb$_cache$ on Windows). If the cache option \verb$create_local_directory$ is \const{true}, a cache directory is created if posible. \textbf{Global caching} This approach applies to all sources, except for unnamed streams. Triples are cached in directory defined by the cache option \verb$global_directory$. When loading an RDF file, the system scans the configured cache files unless \verb$cache(false)$ is specified as option to \predref{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.\vspace{0.7cm} \begin{description} \predicate{rdf_set_cache_options}{1}{+Options} Change the cache policy. Provided options are: \begin{itemize} \item \verb$enabled(Boolean)$ If \const{true}, caching is enabled. \item \verb$local_directory(Name)$. Plain name of local directory. Default \verb$.cache$ (\verb$_cache$ on Windows). \item \verb$create_local_directory(Bool)$ If \const{true}, try to create local cache directories \item \verb$global_directory(Dir)$ Writeable directory for storing cached parsed files. \item \verb$create_global_directory(Bool)$ If \const{true}, try to create the global cache directory. \end{itemize} \predicate[semidet]{rdf_cache_file}{3}{+URL, +ReadWrite, -File} \arg{File} is the cache file for \arg{URL}. If \arg{ReadWrite} is \const{read}, it returns the name of an existing file. If \const{write} it returns where a new cache file can be overwritten or created. \end{description}