Package org.eclipse.rdf4j.spring.resultcache


package org.eclipse.rdf4j.spring.resultcache

Rdf4j-Spring ResultCache

Automatically configures a cache for Rdf4J query results via the Rdf4JConfig.

Enable via rdf4j.spring.resultcache.enabled=true.

If enabled, the Rdf4JConfig wraps the RepositoryConnectionFactory in a CachingRepositoryConnectionFactory, which wraps RepositoryConnections in CachingRepositoryConnections. These return ResultCachingGraphQuery and ResultCachingTupleQuery wrappers when instantiating queries. The ResultCaching(Tuple|Graph)Query returns a Reusable(Tuple|Graph)QueryResult, which records the results as they are read by the client code and keeps them for future use.

There are two levels of caching: connection-level and global. The connection-level cache is cleared when the connection is closed (or returned to the pool, if pooling is enabled). The global cache is cleared whenever data is written to the repostitory by the application.

Note: global result caching is disabled by default. The reason is that in the general case, we cannot be sure that no other application writes to the repository. If you are really sure that your application is the only one writing to the repository, or if the repository is read-only, you can enable the global result cache using rdf4j.spring.resultcache.assume-no-other-repository-clients=true.

For More information on configuration, see ResultCacheProperties

Since:
4.0.0
Author:
Florian Kleedorfer