【问题标题】:Hazelcast Predicate on KeyHazelcast 对键的谓词
【发布时间】:2021-02-08 14:03:04
【问题描述】:

我有一个 IMap,其中包含 String 键和 Foo 值对象。

IMap<String, String> mapTest1 = client.getMap("testMap");

Foo foo1 = new Foo();
Foo foo2 = new Foo();
Foo foo3 = new Foo();
Foo foo4 = new Foo();

mapTest1.put( "somePrefix1:abc:testKey1", foo1);
mapTest1.put( "somePrefix3:abc:testKey2", foo2);
mapTest1.put( "somePrefix4:def:testKey3", foo3);
mapTest1.put( "somePrefix5:def:testKey4", foo4);

当我将"abc" 作为输入时,我想在List 中获得foo1foo2

当我将"somePrefix1""abc" 作为输入时,我还只想在List 中获得foo1

我怎样才能做到这一点?

【问题讨论】:

    标签: hazelcast


    【解决方案1】:

    您可以使用__key 引用键并将其与LIKE 谓词组合。

    所以这可能是 __key LIKE "%abc%" 使用 3.*4.*

    关于新风格的 SQL,4.1 的 BETA,SELECT this FROM mapname WHERE __key LIKE '%abc%'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-22
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      相关资源
      最近更新 更多