You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

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. There are no restrictions, who can access the content of the stores if the keys are known. The user is responsible for clearing the store, else an OutOfMemory could occur.

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