MemoryScope Class

  • java.lang.Object
    • com.microsoft.bot.dialogs.memory.scopes.MemoryScope

public abstract class MemoryScope

MemoryScope represents a named memory scope abstract class.

Constructor Summary

Constructor Description
MemoryScope(String name, Boolean includeInSnapshot)

Initializes a new instance of the class.

Method Summary

Modifier and Type Method and Description
java.util.concurrent.CompletableFuture<java.lang.Void> delete(DialogContext dialogContext)

Deletes any state in storage and the cache for this.

java.lang.Boolean getIncludeInSnapshot()
abstract java.lang.Object getMemory(DialogContext dialogContext)

Get the backing memory for this scope.

java.lang.String getName()
java.util.concurrent.CompletableFuture<java.lang.Void> load(DialogContext dialogContext, Boolean force)

Populates the state cache for this from the storage layer.

java.util.concurrent.CompletableFuture<java.lang.Void> saveChanges(DialogContext dialogContext, Boolean force)

Writes the state cache for this to the storage layer.

void setIncludeInSnapshot(Boolean withIncludeInSnapshot)
abstract void setMemory(DialogContext dialogContext, Object memory)

Changes the backing object for the memory scope.

void setName(String withName)

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

MemoryScope

public MemoryScope(String name, Boolean includeInSnapshot)

Initializes a new instance of the class.

Parameters:

name - Name of the scope.
includeInSnapshot - Value indicating whether this memory should be included in snapshot.

Method Details

delete

public CompletableFuture delete(DialogContext dialogContext)

Deletes any state in storage and the cache for this.

Parameters:

dialogContext - The dialog context Object for this turn.

Returns:

CompletableFuture A future that represents the work queued to execute.

getIncludeInSnapshot

public Boolean getIncludeInSnapshot()

Returns:

Boolean Returns the value indicating whether this memory should be included in snapshot.

getMemory

public abstract Object getMemory(DialogContext dialogContext)

Get the backing memory for this scope.

Parameters:

dialogContext - The DialogContext to get from the memory store.

Returns:

Object The memory for this scope.

getName

public String getName()

Returns:

String Gets the name of the scope.

load

public CompletableFuture load(DialogContext dialogContext, Boolean force)

Populates the state cache for this from the storage layer.

Parameters:

dialogContext - The dialog context object for this turn.
force - True to overwrite any existing state cache or false to load state from storage only if the cache doesn't already exist.

Returns:

CompletableFuture A future that represents the work queued to execute.

saveChanges

public CompletableFuture saveChanges(DialogContext dialogContext, Boolean force)

Writes the state cache for this to the storage layer.

Parameters:

dialogContext - The dialog context Object for this turn.
force - True to save the state cache to storage. or false to save state to storage only if a property in the cache has changed.

Returns:

CompletableFuture A future that represents the work queued to execute.

setIncludeInSnapshot

public void setIncludeInSnapshot(Boolean withIncludeInSnapshot)

Parameters:

withIncludeInSnapshot - Sets the value indicating whether this memory should be included in snapshot.

setMemory

public abstract void setMemory(DialogContext dialogContext, Object memory)

Changes the backing object for the memory scope.

Parameters:

dialogContext - The DialogContext to set in memory store.
memory - The memory to set the DialogContext to.

setName

public void setName(String withName)

Parameters:

withName - Sets the name of the scope.

Applies to