Package org.keycloak.expiration.jpa
Interface ExpirationAction
- All Known Implementing Classes:
LoginFailureExpirationAction,RevokedTokenExpirationAction,SingleUseObjectExpirationAction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A callback that removes expired entries from the database.
Implementations execute the actual deletion logic (e.g. a JPA query) and report how many rows were removed via the
removeCount consumer. The framework calls this method inside a transaction, potentially multiple times in a
loop to support batched deletions.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanremoveExpired(KeycloakSession session, String realmId, int currentTime, int maxRemoval, IntConsumer removeCount) Removes expired entries from the database.
-
Method Details
-
removeExpired
boolean removeExpired(KeycloakSession session, String realmId, int currentTime, int maxRemoval, IntConsumer removeCount) Removes expired entries from the database.This method is invoked inside a transaction. It should delete a batch of expired entries whose expiration time is at or before
currentTimeand report the number of removed rows viaremoveCount.- Parameters:
session- the current Keycloak session, valid for the duration of the enclosing transaction.realmId- the realm to clean up, ornullfor non-realm-aware expiration tasks.currentTime- the current time in seconds since epoch, used as the expiration threshold. This value is constant across all batches within a single task run.maxRemoval- the maximum number of entries to remove in this batch.removeCount- a consumer to report the number of entries removed in this batch.- Returns:
trueif there are more expired entries to remove (the framework will call this method again in a new transaction);falseif all expired entries have been removed.
-