【问题标题】:GAE development server memcached never returns anythingGAE 开发服务器 memcached 从不返回任何内容
【发布时间】:2014-01-08 16:42:38
【问题描述】:

我在 Google App Engine 中运行了一些简单的 python 代码,例如:

types = memcache.get('types')
if types is None:
    # do something, creating a 'types' object
    memcache.set('types', types, 36000000)

每当我在本地开发服务器上运行它时,memcache.get('types') 总是返回 None。它在 App Engine 上不一样,memcache 调用正常工作。

是否需要在本地安装单独的包以及 GAE 开发服务器?

【问题讨论】:

    标签: python google-app-engine memcached local


    【解决方案1】:

    memcache.settime 参数最多可以是一个月以指示相对生命周期,否则将被解释为绝对 unix 时间戳(自 1970 年以来的秒数)。 36000000 远远超过一个月,因此它将条目设置为在 1971 年 2 月到期。

    如果您希望某些内容尽可能长时间地保留在缓存中,请忽略时间参数。

    【讨论】:

    猜你喜欢
    • 2023-03-15
    • 1970-01-01
    • 2014-05-15
    • 1970-01-01
    • 2021-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多