Sometimes it is necessary to keep global information. These functions provide very simple key value store functionality.There are two kinds of stores named and unnamed. The user is responsible for clearing the store, else an OutOfMemory could occur.

A more advanced version can be found in the Key Value Store Feature.

kvwrite(String key, Object value)

Stores a value under the given key. If there is already a value, this value is overwritten.

kvread(String key)

Returns the value that is stored with this key. If no value is stored, null will be returned,

kvremove(String key)

Same as kvread but removes the value from the store.


#PARSER PQL
#RUNQUERY
timer = TIMER({
            period = 1000,
            source = 'timersource'
          }
        )

Map1 = MAP({
            expressions = [
                    'kvwrite("10","1",1)',
                    ['kvread("10","1")','out'],
                    'kvremove("10","1")',
                    ['kvread("10","1")','ShouldBeNull']
            ]
          },
          timer
)
Map2 = MAP({
            expressions = [
                    'kvwrite("1",1)',
                    ['kvread("1")','out'],
                    'kvremove("1")',
                    ['kvread("1")','ShouldBeNull']
            ]
          },
          timer
)
  • No labels