Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WDESIGNER and version 24.0

The Memory Adapter allows to store an entire hash map to memory. The hash map object as a whole can be managed with the Memory adapter the same way as any other objects.
Additionally, the Memory adapter allows to add, change, retrieve, and remove single elements from a stored hash map. Therefore, the Memory adapter provides an additional parameter hashMapKey. If this parameter is provided, the Memory adapter does not access the entire map, but tries to access the specified element of the map.

In comparison to caching data in a database, this can significantly increase the performance if you e.g. want to cache some data you frequently need to lookup. Using hash maps is much faster than storing single values as you can store all values with one store operation call, and you can still access single values using retrieve with hashMapKey (see Retrieving Data from the Map below).

Storing a Map to Memory

Using the store operation from the Memory adapter, you can store data. Provide the following parameters:

NameTypeDirectionDescription
keyStringinSet a key that can be used to access the stored map with the retrieve operation.
valueAnyinProvide the complete map that should be stored to the memory.

If a map with the given key already exists in memory, it will be overwritten by the Memory adapter. In this case, parameter oldValue returns the the complete previously stored hash map.

NameTypeDirectionDescription
oldValueAnyoutIf the provided key is already present in the memory, it gets overwritten. In this case, oldValue returns the previous value, means the complete hash map. If no old value is present, oldValue is NULL.

Retrieving Data from the Map

You can retrieve the complete hash map as described on Storing to and Retrieving Data from Memory. If you want to retrieve a dedicated hash map element, provide the following parameters:

NameTypeDirectionDescription
keyStringinProvide the key of the map that has been stored to memory with store. If no value with this key can be found, the Memory adapter throws error MEMADSM/9.
hashMapKeyStringinProvide the key to the hash map element you want to retrieve.

The Memory adapter returns a single map element containing the data from the map. If there is no map element with the given key, the Memory adapter throws an error.

NameTypeDirectionDescription
valueAnyoutReturns the stored map entry.

Related Error Codes

Find a list of all persistent state error codes on System Errors of the Memory Adapter.

Error CodeDescription
MEMADSM/9The message is not stored here.

Adding or Changing Data in the Map

You can add or change data in the hash map that has been stored to memory. To do this, provide the following parameters:

NameTypeDirectionDescription
keyStringinSet the key that has been used to store the map to memory.
valueAnyinProvide the data that should be added to the hash map in memory.
hashMapKeyStringinProvide the key of the hash map entry you want to add or change.
Info
iconfalse

If there is no map element with the given key, the Memory adapter will add this element to the map.
If the map element with the given key is already existing in the map, it will be updated to the provided value. In this case, parameter oldValue returns the complete previously stored hash map.

NameTypeDirectionDescription
oldValueAnyoutoldValue returns the complete previously stored hash map if you are changing a hash map entry. If the hash map entry has been added, oldValue is NULL.
Panel
titleOn this Page:
Table of Contents
OtpFloatingfalse

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameMemoryAdapter_HashMap_Example
PageWithExcerptINTERNAL:_designer_examples

rp
Panel
titleRelated Pages: