Interface OracleCacheEntryRepository

All Superinterfaces:
io.micronaut.data.repository.CrudRepository<CacheEntryEntity, CacheEntryId>, io.micronaut.data.repository.GenericRepository<CacheEntryEntity, CacheEntryId>

@JdbcRepository(dialect=ORACLE, dataSource="${micronaut.oracle.cache.datasource}") public interface OracleCacheEntryRepository extends io.micronaut.data.repository.CrudRepository<CacheEntryEntity, CacheEntryId>
Repository for cache entry rows.
Since:
6.2.0
Author:
Davide Cocco
  • Method Summary

    Modifier and Type
    Method
    Description
    blockingPut(String cacheName, byte[] keyHash, byte[] keyPayload, byte[] valuePayload, @Nullable Instant expiresAt, long valueWeight, long insertOnly)
    Writes a value using the database-coordinated blocking put procedure.
    long
    Counts entries for a cache.
    long
    Deletes a cache entry by id.
    long
    Deletes all entries for a cache.
    void
    runCleanupProcedure(String cacheName, long batchSize)
    Runs the database cleanup procedure for a cache.
    long
    totalWeight(String cacheName)
    Calculates the total weight for entries in a cache.
    void
    update(CacheEntryId id, Instant lastAccessAt, @Nullable Instant expiresAt)
    Updates access metadata for a cache entry.

    Methods inherited from interface io.micronaut.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteById, existsById, findAll, findById, insert, insertAll, save, saveAll, update, updateAll
  • Method Details

    • update

      void update(@Id CacheEntryId id, Instant lastAccessAt, @Nullable @Nullable Instant expiresAt)
      Updates access metadata for a cache entry.
      Parameters:
      id - The cache entry id
      lastAccessAt - The last access timestamp
      expiresAt - The next expiration timestamp
    • delete

      long delete(@Id CacheEntryId id)
      Deletes a cache entry by id.
      Parameters:
      id - The cache entry id
      Returns:
      The number of deleted rows
    • countByCacheName

      long countByCacheName(String cacheName)
      Counts entries for a cache.
      Parameters:
      cacheName - The cache name
      Returns:
      The number of entries
    • deleteByCacheName

      long deleteByCacheName(String cacheName)
      Deletes all entries for a cache.
      Parameters:
      cacheName - The cache name
      Returns:
      The number of deleted rows
    • blockingPut

      String blockingPut(String cacheName, byte[] keyHash, byte[] keyPayload, byte[] valuePayload, @Nullable @Nullable Instant expiresAt, long valueWeight, long insertOnly)
      Writes a value using the database-coordinated blocking put procedure.
      Parameters:
      cacheName - The cache name
      keyHash - The cache key hash
      keyPayload - The serialized cache key payload
      valuePayload - The serialized cache value payload
      expiresAt - The expiration timestamp
      valueWeight - The value weight
      insertOnly - Whether to only insert when absent
      Returns:
      The procedure status
    • runCleanupProcedure

      void runCleanupProcedure(String cacheName, long batchSize)
      Runs the database cleanup procedure for a cache.
      Parameters:
      cacheName - The cache name
      batchSize - The cleanup batch size
    • totalWeight

      @Query(value="SELECT COALESCE(SUM(COALESCE(VALUE_WEIGHT, 1)), 0) FROM ${micronaut.oracle.cache.prefix:`MN`}_CACHE_ENTRY WHERE CACHE_NAME = :cacheName", nativeQuery=true) long totalWeight(String cacheName)
      Calculates the total weight for entries in a cache.
      Parameters:
      cacheName - The cache name
      Returns:
      The total entry weight