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 TypeMethodDescriptionblockingPut(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.longcountByCacheName(String cacheName) Counts entries for a cache.longdelete(CacheEntryId id) Deletes a cache entry by id.longdeleteByCacheName(String cacheName) Deletes all entries for a cache.voidrunCleanupProcedure(String cacheName, long batchSize) Runs the database cleanup procedure for a cache.longtotalWeight(String cacheName) Calculates the total weight for entries in a cache.voidupdate(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
Updates access metadata for a cache entry.- Parameters:
id- The cache entry idlastAccessAt- The last access timestampexpiresAt- The next expiration timestamp
-
delete
Deletes a cache entry by id.- Parameters:
id- The cache entry id- Returns:
- The number of deleted rows
-
countByCacheName
Counts entries for a cache.- Parameters:
cacheName- The cache name- Returns:
- The number of entries
-
deleteByCacheName
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 namekeyHash- The cache key hashkeyPayload- The serialized cache key payloadvaluePayload- The serialized cache value payloadexpiresAt- The expiration timestampvalueWeight- The value weightinsertOnly- Whether to only insert when absent- Returns:
- The procedure status
-
runCleanupProcedure
Runs the database cleanup procedure for a cache.- Parameters:
cacheName- The cache namebatchSize- 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
-