-
Notifications
You must be signed in to change notification settings - Fork 14
Migration Guide for the Cache
The old way of using the cache using classes such as Cache
, CacheCoreEx
, etc is deprecated.
There is now the class CacheFrontend
, which operates on high level Jena objects, such as Model and ResultSet.
Its default implementation CacheFrontendImpl
converts these high level object to and from streams and delegates read and write requests to CacheBackend
, which only offers an API based on streams.
CacheBackend
is storage agonastic.
CacheBackendDao
(the naming of this class is bad, as it is NOT a subclass of CacheBackend) offers a similar API like CacheBackend
, however, it takes a database connection as an additional argument.
CacheBackendDataSource
is a CacheBackend
that is backed by a DataSource.
On read/write calls, a Connection is obtained from the DataSource and a transaction is started.
The Connection object is then passed to the CacheBackendDao
, which implements CacheBackendDao
by executing the appropriate SQL statements (in the appropriate SQL dialect).
import org.aksw.jena_sparql_api.cache.staging.CacheBackendDao;
import org.aksw.jena_sparql_api.cache.staging.CacheBackend;
import org.aksw.jena_sparql_api.cache.staging.CacheFrontend;
CacheBackendDao dao = new CacheBackendDaoPostgres();
CacheBackend cacheBackend = new CacheBackendDataSource(dataSource, dao);
CacheFrontend cacheFrontend = new CacheFrontendImpl(cacheBackend);