Package akka.javasdk.agent
Record Class MemoryProvider.LimitedWindowMemoryProvider
- All Implemented Interfaces:
MemoryProvider
- Enclosing interface:
MemoryProvider
public static record MemoryProvider.LimitedWindowMemoryProvider(Optional<Integer> readLastN, boolean read, boolean write)
extends Record
implements MemoryProvider
Memory provider that limits session history based on size or message count.
This provider allows fine-grained control over memory usage by limiting:
- Use only last N messages from the history
- Whether reading from memory is enabled
- Whether writing to memory is enabled
-
Nested Class Summary
Nested classes/interfaces inherited from interface akka.javasdk.agent.MemoryProvider
MemoryProvider.CustomMemoryProvider, MemoryProvider.Disabled, MemoryProvider.FromConfig, MemoryProvider.LimitedWindowMemoryProvider
-
Constructor Summary
ConstructorsConstructorDescriptionLimitedWindowMemoryProvider
(Optional<Integer> readLastN, boolean read, boolean write) Creates an instance of aLimitedWindowMemoryProvider
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
read()
Returns the value of theread
record component.readLast
(int onlyLastN) Creates a new memory provider with an updated history limit.Returns the value of thereadLastN
record component.readOnly()
Creates a read-only version of this memory provider.final String
toString()
Returns a string representation of this record class.boolean
write()
Returns the value of thewrite
record component.Creates a write-only version of this memory provider.
-
Constructor Details
-
LimitedWindowMemoryProvider
Creates an instance of aLimitedWindowMemoryProvider
record class.- Parameters:
readLastN
- the value for thereadLastN
record componentread
- the value for theread
record componentwrite
- the value for thewrite
record component
-
-
Method Details
-
readOnly
Creates a read-only version of this memory provider.The returned provider will allow reading from memory but disable writing.
- Returns:
- A new memory provider with writing disabled
-
writeOnly
Creates a write-only version of this memory provider.The returned provider will allow writing to memory but disable reading.
- Returns:
- A new memory provider with reading disabled
-
readLast
Creates a new memory provider with an updated history limit.The history limit controls the maximum number of messages to retain in memory.
- Parameters:
onlyLastN
- parameter controls the maximum number of most recent messages to read from memory.- Returns:
- A new memory provider with the specified history limit
-
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 '=='. -
readLastN
Returns the value of thereadLastN
record component.- Returns:
- the value of the
readLastN
record component
-
read
public boolean read()Returns the value of theread
record component.- Returns:
- the value of the
read
record component
-
write
public boolean write()Returns the value of thewrite
record component.- Returns:
- the value of the
write
record component
-