Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • MemoryStore: A key value store that keep the values in memory only
  • FileStore: A key value store that keeps the data in main memory and stores it additionally to disk
  • With a plugin you could write to a Redis-Store.

Default Store

For each user, there exisists a default store. This is a memory store and has no name. To access this store, left parameter for store name empty. This store is created, when the store is first accessed.

Creating a store

A store can be created with the Odysseus Script command: #CREATE_KV_STORE name type (PARAM_1_KEY=PARAM_1_VALUE,..., PARAM_N_KEY=PARAM_N_VALUE)

...

MEP functions can be used to read an write from the store. So this can be used in (mostly) all operators that contain expressions or predicates (e.g. Map operator or , Select operator, Route operator)

  • kvwrite(String StoreName, String KeyName, Object Value): (Overwrites) a value in the give store and key
  • kvread(String StoreName, String KeyName): reads the value from the store with the key
  • kvremove(String StoreName, String KeyName): remove the value from the store

The default store is used, when the storeName is not given.

The following code block shows an example

...

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

out = StoreWriter({IdAttribute='time', store="test2")},timer)

OdysseusScript

Writing to and removing from a store can also be done with Odysseus script. Remark that these functions will only be executed once to a script. If a query is stopped and started again this will not call the Odysseus script part again

Code Block
#KV_STORE_WRITE STORENAME KEY VALUE
#KV_STORE_REMOVE STORENAME KEY

As in other cases, when omitting the STORENAME the users default store is used.