Google App Engine 上的 Datanucleus/JDO 2 级缓存

发布于 2024-08-16 12:49:40 字数 857 浏览 7 评论 0原文

是否可以(并且有意义)将 JDO 2 级缓存用于 Google App Engine 数据存储区?

首先,为什么谷歌的页面上没有关于此的文档?它有一些问题吗?我们是否需要设置限制来保护我们的内存缓存配额?

根据Stackoverflow上的DataNucleus,可以设置以下持久化属性:

 datanucleus.cache.level2.type=javax.cache
 datanucleus.cache.level2.cacheName={cache name}

就这些吗?我们可以选择任何缓存名称吗?

其他 <互联网上的 href="http://code.google.com/p/googleappengine/issues/detail?id=2601" rel="nofollow noreferrer">来源使用不同的设置。

另外,我们似乎需要下载 DataNucleus Cache 支持插件。哪个版本合适?我们是否只是将其放在 WEB-INF/lib 中还是需要更多设置来激活它?

Is it possible (and does it make sense) to use the JDO Level 2 Cache for the Google App Engine Datastore?

First of all, why is there no documentation about this on Google's pages? Are there some problems with it? Do we need to set up limits to protect our memcache quota?

According to DataNucleus on Stackoverflow, you can set the following persistence properties:

 datanucleus.cache.level2.type=javax.cache
 datanucleus.cache.level2.cacheName={cache name}

Is that all? Can we choose any cache name?

Other sources on the Internet report using different settings.

Also, it seems we need to download the DataNucleus Cache support plugin. Which version would be appropriate? And do we just place it in WEB-INF/lib or does it need more setup to activate it?

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

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

发布评论

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

评论(3

执手闯天涯 2024-08-23 12:49:40

在你弄清楚这一点之前,你必须回答一个问题:

你使用的是哪个版本的 DataNucleus?

这篇文章中的所有内容都与旧版本的插件 - v1.1 相关。直到最近,Google Plugin for Eclipse 才支持 AppEngine 的 DataNucleus 插件 v2(基本上是 AppEngine 和 DataNucleus Core 之间的管道)。

我建议升级到 AppEngine 的 Datanucleus 插件 v2——如果您使用 Eclipse,这很容易——有一个 UI 允许您选择 v1 或 v2。只需转到您的项目属性并找到 App Engine 设置并查找“Datanucleus JDO/JPA 版本”。

另外,您必须对 jdo-config.xml 进行更改。具体来说,您只需更改一个属性:

<property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>

SO -- 一旦您升级到 v2,这就是您指定缓存的方式(jdoconfig.xml 的补充):

<property name="datanucleus.cache.level2.type" value="jcache"/>
<property name="datanucleus.cache.level2.cacheName" value="NameItWhateverYouWant"/>

此时,每次您放置和获取时,缓存都应该自动发生使用持久性管理器。万岁!

Before you can figure this out, you have to answer one question:

Which version of DataNucleus are you using?

Everything on this post has to do with the old version of the plugin -- v1. Only recently has the Google Plugin for Eclipse supported v2 of the DataNucleus plugin for AppEngine (which is basically the conduit between AppEngine and the DataNucleus Core).

I'd recommend upgrading to v2 of the Datanucleus plugin for AppEngine -- if you're using Eclipse, it's easy -- there's a UI for it that allows you to select v1 or v2. Just go to your Project properties and find the App Engine settings and look for "Datanucleus JDO/JPA version".

Plus, you have to make a change to your jdo-config.xml. Specifically, you have to change just one property:

<property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>

SO -- Once you've upgraded to v2, this is how you specify caching (an addition to jdoconfig.xml):

<property name="datanucleus.cache.level2.type" value="jcache"/>
<property name="datanucleus.cache.level2.cacheName" value="NameItWhateverYouWant"/>

At this point, caching should happen automatically every time you put and get using a PersistenceManager. Hooray!

时光沙漏 2024-08-23 12:49:40

没有与 L2 缓存和 GAE/J 有关的已知问题。如果人们遇到问题,那么也许他们应该向谷歌报告。将缓存名称设置为您想要的名称。显然,放入 memcache 的任何内容都必须是可序列化的,因为这就是 memcache 的作用。是的,您需要 datanucleus-cache 插件(1.x 版),并将其放在与任何其他 DN jar 相同的位置。有一天 Google 将更新为使用 DN 2.x

No known problems with anything to do with L2 caching and GAE/J. If people have problems then perhaps they ought to report them to Google. Set the cache name to what you wish. Anything put into memcache has to be Serializable, obviously, since that is what memcache does. Yes, you need the datanucleus-cache plugin (ver 1.x), and put it in the same place as any other DN jars. One day Google will update to use DN 2.x

冰魂雪魄 2024-08-23 12:49:40

它似乎有问题:我尝试(使用 JPA),但收到了其他人已经报告的错误:http://code.google.com/p/datanucleus-appengine/issues/detail?id=163

It seems to have problems instead: I tried (with JPA) and I got the error someone else already reported: http://code.google.com/p/datanucleus-appengine/issues/detail?id=163

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