Sign In Register

How can we help you today?

Start a new topic
Answered

Caching game table data - best practices?

Hi there,


The server side logic that we are implementing requires lookups into various tables and some calculations against that data. The data itself is reasonably static and an ideal candidate for caching so I am wondering what is the recommended way to do that with GameSparks? I'd rather not run mongodb queries every time i need this data.


An example would be a loot table.  If I were setting up my own backend, i'd have this loaded into a cache on the vm that could be accessed locally without having to hit a db (except for vm initialization). The data is shared across users and needless to say this provides excellent performance.


Any help greatly appreciated, thanks!


Thanks!
- Toby


Best Answer

Hi Toby


All calls to metadata collections within cloud call are already cached by the platform. If it's a call to a metadata collection your mongo query will only go to mongo if the query results have not already been cached.


Gabriel


Answer

Hi Toby


All calls to metadata collections within cloud call are already cached by the platform. If it's a call to a metadata collection your mongo query will only go to mongo if the query results have not already been cached.


Gabriel

Thanks for the response Gabriel,


I'd like to get a little more detail on the caching mechanism if possible. Are the cached queries located on the same vm that the cloud code is being run on  (i.e. something similar to memcached) or is there a network call involved?


Thanks again,

- Toby

Hi Toby


This is an in memory cache on the cloud code VM's. The cache is flushed when a game publish event occurs.


Gabriel

Login to post a comment