带有“put”功能的 Infinispan MVCC
今天我想用 Infinispan 来做一些可能不熟悉的事情。 我想保存一个变量,让我们在缓存中调用它几次 - 同时能够将其寻址为 X.Plain
、旧的 MVCC。然而,似乎 infinispan 在后端使用 MVCC - 但我无法在我的小测试应用程序中使用它。
这是相应的代码:
acTest.put("test", "blubber", 0, TimeUnit.MILLISECONDS );
acTest.put("test", "nothing", 0, TimeUnit.MILLISECONDS );
if( acTest.containsKey("test") )
{
Object foo = acTest.get("test"); // don't know how to get the "blubber" out of that
String name = (String) test2.get("name");
System.out.println(name);
}
果然,acTest 包含该键 - 但我无法解决该键的值“blubber” - 当我提高“nothing”的数值时,foo 保留“nothing”...但我想要获得“foo”的第一个版本 - 因此“blubber”
我希望能够解决测试的不同版本。我认为我可以在 put 操作中使用不同的参数创建不同版本的“test” - 但是 eclipse 绝对没有这方面的文档......
有人可以帮助我吗?
I wanted to use Infinispan today in a sort of probably unfamiliar matter.
I want to save a Variable, let's call it x a couple of times in the cache - while being able to adress it as X.
Plain, old MVCC. However, it seems that infinispan uses MVCC on the backend - but I wasn't able to use it in my little test-application.
This is the corresponding code:
acTest.put("test", "blubber", 0, TimeUnit.MILLISECONDS );
acTest.put("test", "nothing", 0, TimeUnit.MILLISECONDS );
if( acTest.containsKey("test") )
{
Object foo = acTest.get("test"); // don't know how to get the "blubber" out of that
String name = (String) test2.get("name");
System.out.println(name);
}
Sure enough, acTest contains the key - but I was not able to adress the value "blubber" of that key - when I higher the numerical value of "nothing" foo holds "nothing" ... but I want to get the first version of "foo" - hence "blubber"
I want to be able to adress the different versions of test. I think that I can create different versions of "test" with the different parameters in the put operation - however eclipse has absolutely no documentation for that matter ...
Could somebody help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Infinispan 在其容器中将 MVCC 用于内部用途,除了通过 writeSkewCheck 之外,目前这不是通过用户 API 公开的功能。
在版本 5.1 中,API 将公开乐观锁定,这对于某些需要利用 MVCC 功能的用例可能很有用,但您仍然无法提取以前的值。
您可以使用 AtomicMap 存储多个值,或使用包含版本的自定义键对象,在 Infinispan 的 API 之上构建您需要的内容。
DeltaAware 是另一种选择,但它是一个面向专家的低级界面。
Infinispan uses MVCC in it's container for internal purposes, this is currently not a feature exposed via user API, besides via writeSkewCheck.
In version 5.1 the API will expose Optimistic locking, which might be useful for some use cases needing to take advantage of the MVCC capabilities, but you still won't be able to extract a previous value.
You could use AtomicMap to store multiple values, or use custom key objects containing the version, building what you need on top of Infinispan's API.
DeltaAware is another option, but it's a low-level interface meant for experts.