FAQ
Is it possible to keep data in instance local memory between requests in a
Go GAE app? I would like to implement a multi-level cache:

    - Level 1 cache: Read from instance local memory e.g. regular Go maps
    <http://blog.golang.org/go-maps-in-action>
    - Level 2 cache: Read from Memcache if key not present in level 1 cache
    - Level 3 "cache": Read from Datastore if key not present in level 2
    cache

I a Java GAE app, I would keep a static map in a singleton to keep data in
memory between requests (or use Guava's LoadingCache
<http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/LoadingCache.html>
).

Is it possible to do something similar in Go before looking up data in
memcache?

Thanks,
Ingo

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Qian Qiao at Sep 27, 2014 at 8:49 pm

    On 27 September 2014 14:51, Ingo Jaeckel wrote:

    Is it possible to keep data in instance local memory between requests in a
    Go GAE app? I would like to implement a multi-level cache:

    - Level 1 cache: Read from instance local memory e.g. regular Go maps
    <http://blog.golang.org/go-maps-in-action>
    - Level 2 cache: Read from Memcache if key not present in level 1 cache
    - Level 3 "cache": Read from Datastore if key not present in level 2
    cache

    I a Java GAE app, I would keep a static map in a singleton to keep data in
    memory between requests (or use Guava's LoadingCache
    <http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/LoadingCache.html>
    ).

    Is it possible to do something similar in Go before looking up data in
    memcache?

    Thanks,
    Ingo

    It is possible. David Symonds even talked about this in one of his Google
    I/O talks[1]. As long as you are aware that data in your local instance is
    lost when the instance is terminated and is not replicated across instances.

    -- Joe

    [1] http://talks.golang.org/2013/highperf.slide#19

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 27, '14 at 6:51p
activeSep 27, '14 at 8:49p
posts2
users2
websitegolang.org

2 users in discussion

Ingo Jaeckel: 1 post Qian Qiao: 1 post

People

Translate

site design / logo © 2022 Grokbase