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 Type
    Method
    Description
    void
    Atomically increments the hit count of the cached response for requestPath with a single Mongo $inc, so concurrent cache hits can't overwrite each other's increments the way a read-modify-save() would.
     

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.mongodb.repository.MongoRepository

    findAll, findAll, insert, insert

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findByRequestPath

      Optional<CachedResponse> findByRequestPath(String requestPath)
    • findAndIncrementHitCountByRequestPath

      @Update("{ '$inc' : { 'hitCount' : 1 } }") void findAndIncrementHitCountByRequestPath(String requestPath)
      Atomically increments the hit count of the cached response for requestPath with a single Mongo $inc, so concurrent cache hits can't overwrite each other's increments the way a read-modify-save() would.