Package org.keycloak.models
Interface SingleUseObjectProvider
- 
- All Superinterfaces:
- Provider
 - All Known Implementing Classes:
- InfinispanSingleUseObjectProvider,- MapSingleUseObjectProvider
 
 public interface SingleUseObjectProvider extends Provider Provides a cache to store data for single-use use case or the details about used action tokens.- Author:
- Marek Posolda
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringREVOKED_KEY
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontains(String key)Checks if there is a record in the store for the given key.Map<String,String>get(String key)Gets data associated with the given key.voidput(String key, long lifespanSeconds, Map<String,String> notes)Stores the given data and guarantees that data should be available in the store for at least the time specified by {@param lifespanSeconds} parameterbooleanputIfAbsent(String key, long lifespanInSeconds)Will try to put the key into the cache.Map<String,String>remove(String key)This method returns data just if removal was successful.booleanreplace(String key, Map<String,String> notes)Replaces data associated with the given key in the store if the store contains the key.
 
- 
- 
- 
Field Detail- 
REVOKED_KEYstatic final String REVOKED_KEY - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
putvoid put(String key, long lifespanSeconds, Map<String,String> notes) Stores the given data and guarantees that data should be available in the store for at least the time specified by {@param lifespanSeconds} parameter- Parameters:
- key-
- lifespanSeconds-
- notes-
 
 - 
getMap<String,String> get(String key) Gets data associated with the given key.- Parameters:
- key- String
- Returns:
- MapData associated with the given key or nullif there is no associated data.
 
 - 
removeMap<String,String> remove(String key) This method returns data just if removal was successful. Implementation should guarantee that "remove" is single-use. So if 2 threads (even on different cluster nodes or on different cross-dc nodes) calls "remove(123)" concurrently, then just one of them is allowed to succeed and return data back. It can't happen that both will succeed.- Parameters:
- key-
- Returns:
- context data associated to the key. It returns nullif there are no context data available.
 
 - 
replaceboolean replace(String key, Map<String,String> notes) Replaces data associated with the given key in the store if the store contains the key.- Parameters:
- key- String
- notes- Map- New data to be stored 
- Returns:
- trueif the store contains the key and data was replaced, otherwise- false.
 
 - 
putIfAbsentboolean putIfAbsent(String key, long lifespanInSeconds) Will try to put the key into the cache. It will succeed just if key is not already there.- Parameters:
- key-
- lifespanInSeconds- Minimum lifespan for which successfully added key will be kept in the cache.
- Returns:
- true if the key was successfully put into the cache. This means that same key wasn't in the cache before
 
 - 
containsboolean contains(String key) Checks if there is a record in the store for the given key.- Parameters:
- key- String
- Returns:
- trueif the record is present in the store,- falseotherwise.
 
 
- 
 
-