google-app-engine - Memcached:缓存对象总是好的? (GAE 客观化)

标签 google-app-engine caching memcached objectify

上下文:使用 Memcached。 (使用 Google App Engine 和 Objectify,但这无关紧要)

我将创建一个简单的示例,一个具有两个实体 Player 和 Game 的游戏。用户通常可以查阅已打开的单个请求游戏甚至玩家资料。可能有开放的 100 场比赛,也可能有 3000000 场比赛。

(1) 对所有实体使用缓存是个好主意吗?如果我有未使用的 RAM,为什么不将其用于游戏或播放器? 这有不好的案例吗? (除了几乎没有时间获取缓存访问数据之外)

(2) 另一个问题是,加载对象时,是否应该分区以优化存储的对象?并缓存?例如:

player {
  email
  pass

  punctuation          // This data will change quite frequently
  numGamesClosed       // This data will change quite frequently
}

也许更好:

 @Entity     //DataStore entity
 player {
    email
    pass
 }

 @Cache     //The entity will be cached into Memchached
 @Entity    //DataStore entity
 DatosJugador
 {
    @Parent Key <Player> owner;
    punctuation
    numGamesClosed      
 }

非常感谢

最佳答案

memcache 使用的“ram”不是来自您的应用程序,而是来自共享的 GAE 通用的 memcached 内存池。应用程序的所有实例“看到”相同的内存缓存。

您放入内存缓存的内容不会计入您的应用程序 RAM 使用情况。

但是,memcache 的内容可以随时被逐出,恕不另行通知。因此,实际上没有理由(除了可以放入内存缓存的对象大小的上限之外)不缓存所有内容,只要在您请求时数据不在缓存中时您可以回退到数据存储。

关于google-app-engine - Memcached:缓存对象总是好的? (GAE 客观化),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13800852/

相关文章:

php - 在 yii2 中使用缓存时呈现动态 csrf 隐藏输入

memcached - 为什么是内存缓存?

python - 如何在 google app engine/w python 中管理跨处理程序类的身份验证

java - 有没有任何指南展示如何在 Eclipse 中使用 appengine 和 Maven 有效构建应用程序?

apache - 在 ubuntu 14.04 上的 Apache2 中设置缓存

asp.net - 与浏览器缓存相比,输出缓存的优势

linux - Linux 系统上的内存使用

php - Memcache 结果和 while 循环

android - 带有 Retrofit 的 App Engine 端点

python - 访问不存在的版本标签上的 Google 云端点