CustomizedMemory class
A customized memory designed for LG evaluation, in which we want to make sure the global memory (the first memory passed in) can be accessible at any sub evaluation process.
Constructors
Customized |
Creates a new instance of the CustomizedMemory class. |
Properties
global |
Global memory. |
local |
Local memory. |
Methods
get |
Try to get the value from a given path. Firstly, get result from global memory, if global memory does not contain, get from local memory. |
set |
Set value to a given path. This method is not implemented. |
version() | Used to identify whether a particular memory instance has been updated or not. If version is not changed, the caller may choose to use the cached result instead of recomputing everything. |
Constructor Details
CustomizedMemory(unknown, MemoryInterface)
Creates a new instance of the CustomizedMemory class.
new CustomizedMemory(scope?: unknown, localMemory?: MemoryInterface)
Parameters
- scope
-
unknown
Optional. Scope.
- localMemory
-
MemoryInterface
Optional. Local memory.
Property Details
globalMemory
Global memory.
globalMemory: MemoryInterface
Property Value
MemoryInterface
localMemory
Local memory.
localMemory: MemoryInterface
Property Value
MemoryInterface
Method Details
getValue(string)
Try to get the value from a given path. Firstly, get result from global memory, if global memory does not contain, get from local memory.
function getValue(path: string): any
Parameters
- path
-
string
Memory path.
Returns
any
Resolved value.
setValue(string, any)
Set value to a given path. This method is not implemented.
function setValue(_path: string, _value: any)
Parameters
- _path
-
string
Memory path.
- _value
-
any
Value to set.
version()
Used to identify whether a particular memory instance has been updated or not. If version is not changed, the caller may choose to use the cached result instead of recomputing everything.
function version(): string
Returns
string
A string indicating the version.