Sign In Register

How can we help you today?

Start a new topic

How to save a list of "coin" to a specific collection ?

Hi,


I am currently building a trading / financial application with unity3d, and i could not figure out how to save a list of coin to a new runtime collection i created.


This is the list i am trying to save :

Coin List


The way this will work is : a server pulls all the coin data from different sources, then upload those data to that "coin" runtime collection on GS, updating the coin list every 2 mins or so.

Then, clients will read those data when needed.


So my first step that i can t figure out is how to save those data in GS via cloudcode. I have the generic coin list in unity, and i want to save to that collection, with either creating a new coin, or updating a existing one.


any help, pointers would be greatly appreciated.


Thanks


1 Comment

Hi Romain, 


You have a couple of options here in terms of storage. 

WE provide access to  MongoDb, Redis and SparkCache Services for each game configuration.


Each storage solution is intended for specific use cases. 

If you wish to frequently access and update small amounts of data, you can use Redis. This provides a service for acquiring data within milliseconds, avoiding the need to construct and perform queries. 


SparkCache allows for the same, with some caveats. It is used for data sets which are accessed frequently but are relatively static in that they are not updated frequently. This is a classic cache and utilizes volatile server memory to store data. Therefore it needs to be in the kb to mb range so as not to starve the server of resources. 


Finally we have MongoDB, both Runtime and MetaCollections: Runtime Collections allow for the use of CRUD operations through constructed queries. Data can be read from and written to, as well as be indexed to ensure a scalable solution. Every time you retrieve data it makes a request to the DataBase. If you need to acquire data frequently this will degrade performance. 


MetaCollections are for readonly data. Data must be static. Frequently queried data becomes cached and can be quickly accessed. 


You can read more on storage solutions here.


In your case I imagine redis may be the best fit, as you will probably wish to poll an external  api for access to conversion rates etc. and feed them into redis, as well as needing to acquire data frequently. You will need to exercise caution here when it comes to polling external resources as timeouts can result from slow responses from said resource. You can read more on redis here


Happy to answer any additional questions.


-Patrick. 

Login to post a comment