Package org.keycloak.cache
Record Class LocalCacheConfiguration<K,V>
java.lang.Object
java.lang.Record
org.keycloak.cache.LocalCacheConfiguration<K,V>
- Type Parameters:
K- the type of the cache Keys used for lookupV- the type of the cache Values to be stored- Record Components:
name- the name of the cachemaxSize- the maximum size of the cache, or -1 if an unbounded cache is desired.expiration- theDurationto wait before entries are expired. Anullvalue indicates no expiration.loader- an optionalFunctionwhich is used to retrieve cache values on cache miss.
public record LocalCacheConfiguration<K,V> (String name, int maxSize, Duration expiration, Function<K,V> loader)
extends Record
Configuration
record that encapsulates all configuration required in order to create a LocalCache.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder class to simplify the creation ofLocalCacheConfigurationobjects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> LocalCacheConfiguration.Builder<K, V> builder()final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpirationrecord component.booleanfinal inthashCode()Returns a hash code value for this object.booleanloader()Returns the value of theloaderrecord component.intmaxSize()Returns the value of themaxSizerecord component.name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LocalCacheConfiguration
Creates an instance of aLocalCacheConfigurationrecord class.- Parameters:
name- the value for thenamerecord componentmaxSize- the value for themaxSizerecord componentexpiration- the value for theexpirationrecord componentloader- the value for theloaderrecord component
-
-
Method Details
-
hasExpiration
public boolean hasExpiration() -
hasLoader
public boolean hasLoader() -
builder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
maxSize
public int maxSize()Returns the value of themaxSizerecord component.- Returns:
- the value of the
maxSizerecord component
-
expiration
Returns the value of theexpirationrecord component.- Returns:
- the value of the
expirationrecord component
-
loader
Returns the value of theloaderrecord component.- Returns:
- the value of the
loaderrecord component
-