寻找一个轻量级的Java兼容内存键值存储

发布于 2024-08-27 14:52:05 字数 1539 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

狂之美人 2024-09-03 14:52:05

您可以尝试 Hazelcast。只需将 hazelcast.jar 添加到您的类路径中即可。并开始编码

java.util.Map map = Hazelcast.getMap("myMap");

您将获得一个运行速度超快的内存中、分布式、动态可扩展的数据网格。

You can try Hazelcast. Just add hazelcast.jar to your classpath. And start coding

java.util.Map map = Hazelcast.getMap("myMap");

You'll get an in-memory, distributed, dynamically scalable data grid which performs super fast.

蓝礼 2024-09-03 14:52:05

你的问题可能意味着两件事之一。

如果您指的是用于存储键值对的数据结构,请使用 Map 实例是 JDK 的标准部分。

但是,如果您想要内存中的键值存储,那么我建议您查看 EHCache 甚至 < a href="http://memcached.org/" rel="nofollow noreferrer">memcached。

Your question could mean one of two things.

If you mean a data structure for storing key-value pairs, use one of the Map instances that are a standard part of the JDK.

If however you are after an in-memory key-value store then I would suggest taking a look at EHCache or even memcached.

初熏 2024-09-03 14:52:05

Chronicle-Map 是一个强大的替代方案。

  • 纯 Java,简单的 java.util.Map 实现
  • 将数据存储在堆外,可以选择通过内存映射文件持久保存到磁盘
  • 开源、宽松的 Apache 2.0 许可证
  • 速度快得令人难以置信,可以管理数百万个更新/查询每秒(查看确切数字

Chronicle-Map is a strong alternative.

  • Pure Java, simply java.util.Map implementation
  • Stores the data off-heap, optionally persisted to disk via memory-mapped files
  • Open source, permissive Apache 2.0 license
  • Incredibly fast, can manage millions of updates/queries per second (see exact numbers)
烂人 2024-09-03 14:52:05

我知道这是一篇两年前的帖子,但我最近一直在搞 Infinispan 和到目前为止我很喜欢。无论如何,我都不是专家,但对我来说,设置一个具有几个节点的分布式缓存并不太困难,并且我在大约一个小时内从它们中提取了一些数据。

I know this is a two-year old post but I've been messing around with Infinispan recently and I like it so far. I'm not an expert by any means but it was not too difficult for me to set up a distributed cache with a few nodes and I was pulling some data from them in about an hour.

你又不是我 2024-09-03 14:52:05

MapDb 是 Berkley 的替代品,具有友好的 Apache 2 许可证。

  • 通过 java 的 Map 接口提供键值存储
  • 轻量级(300KB jar)
  • 快速且线程安全
  • 如果需要,可以将更改持久保存到磁盘
  • 许多其他

MapDb is an alternative to Berkley with a friendly Apache 2 license.

  • Provides key-value store via java's Map interface
  • Lightweight (300KB jar)
  • Fast and threadsafe
  • Persists changes to disk if you want to
  • Many other features
洒一地阳光 2024-09-03 14:52:05

jdbm 非常适合此类事情。它旨在以分页文件的形式存储在磁盘上,提供基本事务支持(不保证隔离,但涵盖 ACD)。我们已经在具有相当广泛部署的生产系统中使用了它,并且对性能、稳定性等非常满意......

jdbm works great for this sort of thing. It's intended for storing on disk in a paged file, provides for basic transaction support (no guarantees on isolation, but ACD are covered). We've used it in a production system with fairly wide deployment and have been quite pleased with the performance, stability, etc...

神魇的王 2024-09-03 14:52:05

考虑使用 jredis。它是 Redis(持久键值存储)的 Java 客户端。还有一个 JDBC 驱动程序:code.google.com/p/jdbc-redis/。

Consider using jredis. It's a Java client for Redis, a persistent key-value store. There's also a JDBC driver for it: code.google.com/p/jdbc-redis/.

寒冷纷飞旳雪 2024-09-03 14:52:05

有轻量级或嵌入式数据库,如 HSQLDB、Derby、SQLite
但就像其他人不明白为什么你需要一个数据库来存储键/值......

为什么不是一个地图?
需要在应用程序重新启动时保留键/值?

另外,它可能不是您所需要的,但是在最新的浏览器上使用 html5,您可以使用 localStorage 来使用 javascript 在浏览器中存储键/值。

There are lightweigh or embedded dbs like HSQLDB, Derby, SQLite
But like others don't understand why you need a db to store key/values...

Why not a Map?
Need to keep key/values on app reboot?

Also it's perhaps not what you need but with html5 on up to date browsers you have localStorage that permits you to store key/values in the browser using javascript.

北陌 2024-09-03 14:52:05

我建议尝试 Redisson。您将能够在高性能键值之上使用分布式和可扩展的MapConcurrentMap以及其他(Set、List、Queue、Lock ...)实现Redis 服务器。

简单的例子:

Redisson redisson = Redisson.create();

ConcurrentMap<String, SomeObject> map = redisson.getMap("anyMap");

...

redisson.shutdown();

I would recommend to try a Redisson. You will able to use distributed and scalable Map or ConcurrentMap and other (Set, List, Queue, Lock ...) implementations on top of high performance key-value Redis server.

Easy example:

Redisson redisson = Redisson.create();

ConcurrentMap<String, SomeObject> map = redisson.getMap("anyMap");

...

redisson.shutdown();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文