class CleanRepositoryCache implements Job {

    @Override
    public void execute(JobContext context) {
        log.trace("Starting CleanRepositoryCache Job");
        long startTime = System.currentTimeMillis();
        Repository cacheRepo = repositoryManager.getRepository(repoId)
                .orElseThrow(() -> new IllegalStateException("Ontology Cache Repository" + repoId + " must exist"));

        try (RepositoryConnection conn = cacheRepo.getConnection()) {
            List<Statement> statements = RepositoryResults.asList(
                    conn.getStatements(null, vf.createIRI(OntologyDatasets.TIMESTAMP_IRI_STRING), null));

            OffsetDateTime now = OffsetDateTime.now();
            statements.forEach(statement -> {
                if (now.isAfter(OffsetDateTime.parse(statement.getObject().stringValue()).plusSeconds(expirySeconds))) {
                    log.debug("Evicting expired dataset: " + statement.getSubject().stringValue());
                    datasetManager.safeDeleteDataset(statement.getSubject(), repoId, false);
                }
            });
        }
        log.trace("CleanRepositoryCache Job complete in " + (System.currentTimeMillis() - startTime) + " ms");
    }

}