please explain Reactive State Engine keyPurgeFilter and keyPurgeFreqInSecond

Kindly explain the used of both keyPurgeFilter and keyPurgeFreqInSecond in reactive state engine with example. I didn't find it in https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/c/createReactiveStateEngine.html?highlight=engine

请先 登录 后评论

1 个回答

Feng Gao

Sry for your confuse, we have updated the document. You can find these 2 parameters now. The case is as follows:

In this case , the reactiveStateEngine will delete those stateful data which is 3 days ago (date<today()-3) every 1 second (keyPurgeFreqInSecond=1)) when there is data inputing into the engine

share streamTable(1:0, `date`time`sym`market`price`qty, [DATE, TIME, SYMBOL, CHAR, DOUBLE, INT]) as trades
outputTable = table(100:0, `date`sym`factor1, [DATE, STRING, DOUBLE])
engine = createReactiveStateEngine(name="test", metrics=<mavg(price, 3)>, dummyTable=trades, outputTable=outputTable, keyColumn=`date`sym,  keyPurgeFilter=<date<today()-3>, keyPurgeFreqInSecond=1)

n=1000
tmp = table(rand(2021.10.01..2021.10.10, n) as date, rand(09:00:00.000..15:59:59.999, n) as time, take("A"+string(1..2), n) as sym, rand(['B', 'S'], n) as market, rand(100.0, n) as price, rand(1000..2000, n) as qty)
engine.append!(tmp)

sleep(1000);
print(getStreamEngineStat().ReactiveStreamEngine[`numGroups]);

t = table(rand(2012.01.01..2012.01.10, 1) as date, rand(09:00:00.000..15:59:59.999, 1) as time, take("A"+string(1..2), 1) as sym, rand(['B', 'S'], 1) as market, rand(100.0, 1) as price, rand(1000..2000, 1) as qty)
engine.append!(t)

print(getStreamEngineStat().ReactiveStreamEngine[`numGroups]);
请先 登录 后评论
  • 1 关注
  • 0 收藏,1026 浏览
  • Vishvesh Upadhyay 提出于 2021-10-10 18:48

相似问题