Interface CachedResponseRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<CachedResponse, String>, org.springframework.data.repository.ListCrudRepository<CachedResponse, String>, org.springframework.data.repository.ListPagingAndSortingRepository<CachedResponse, String>, org.springframework.data.mongodb.repository.MongoRepository<CachedResponse, String>, org.springframework.data.repository.PagingAndSortingRepository<CachedResponse, String>, org.springframework.data.repository.query.QueryByExampleExecutor<CachedResponse>, org.springframework.data.repository.Repository<CachedResponse, String>
@Repository
public interface CachedResponseRepository
extends org.springframework.data.mongodb.repository.MongoRepository<CachedResponse, String>
Mongo repository ("collection") for
CachedResponse documents.-
Method Summary
Modifier and TypeMethodDescriptionlongdeleteNotAccessedSince(Instant cutoff) Deletes every cached response last accessed beforecutoff, plus any with nolastAccessedAtat all (documents cached before that field existed; in a Mongo query,nullmatches a missing field).findByRequestPath(String requestPath) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.mongodb.repository.MongoRepository
findAll, findAll, insert, insertMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByRequestPath
-
deleteNotAccessedSince
@DeleteQuery("{ '$or': [ { 'lastAccessedAt': { '$lt': ?0 } }, { 'lastAccessedAt': null } ] }") long deleteNotAccessedSince(Instant cutoff) Deletes every cached response last accessed beforecutoff, plus any with nolastAccessedAtat all (documents cached before that field existed; in a Mongo query,nullmatches a missing field). Deleting a live entry only costs one extra upstream request the next time it's asked for, so treating "unknown" as "stale" is safe.- Returns:
- the number of documents deleted
-