Where should I keep data to continuously use in server? - server

Currently, I'm trying to build a dating app(server part).
I'm going to store each user's profile data like videos, photos, profile messages to AWS S3.
And I have user info including location(longitude, latitude) in my database server.
If you've ever used this kind of app, you might easily understand how it works.
First, whenever a user opens this app, the user gets to see the profile of other users one at a time based on the current location.
Second, the user gives like or dislike to the current profile and gets to the next profile.
So, in order to implement the first step, I'm going to search other users in a certain distance from the user's current location in the database, but here I'm only going to get unique user ID values from database. This only happens once when a user opens the app.
Now that I have other users' id values like [id1, id2, id3, id4...] I can load each user's profile data from AWS S3 with each unique id value one by one whenever the user needs to see the next profile.
Here my question comes. To build the recommendation logic like that, where should I keep the id values??
Thanks in advance.

Use a in memory cache like Redis/memcache (both provided by AWS). Also your cahce should get updated as and when data in AWS S3 profile updates because only then you will have latest data.

Related

How to Implement "Your contact just joined app" feature

I am building a mobile app (in flutter firebase, but the answer does not have to be firebase specific). And I would like to implement a feature that notifies users whenever anyone from their contact list joins the app. This seems like a very EXPENSIVE feature.
At the top of my head, I see a lambda/cloud function that is triggered everytime a user joins and then searches a database of users and their respective contacts for the existence of the new user's phone number. To me, this solution does not scale well for two reasons: if the number of total users is in the millions and the number of users joining simultaneously is a lot.
My better solution is to get the user's contacts upon joining and then searching a database of current users contacts for any of the phone numbers of the newly joined user.
Is there a solution better than the second one? If so, what is it? If the second solution is standard, what kind of backend storage mechanism provides the best search and retrieval time for a database of users and their respective contacts?
In the case of large users ill not do first solution because that may slow the sign up process instead i will creat a cron job that runs at a specific time or periodically it will get the list of the latest users signed up that day or that hour whatever you prefer then that cron will check the new user if related to any user in the databases and send a notification right away, or a better solution create a temporary table in a database in another server insert the notification informations into the other server, creat another cron job in the second server it will run at a specific time to sendthe notification

Use CloudKit to return users records and deny accounts

instead of code, have more of a best practice/functionality question regarding CloudKit. Can't seem to find answers, or maybe just don't understand.
Questions:
When I save the record, cloud kit creates a unique record id, i was thinking of getting that id and storing in core data to allow specific query's on that at a later time vs entire database searches. However, once I save a record, how do i get the record id that was created? Is this possible?
What if I allow a user to report another user for some reason and thereby want to block that user from posting to the cloud until a review can be done. Is there a user access database in the cloud? if not, thoughts on how to?
Thanks all.
By default when you create a CKRecord it will generate a guid as it's ID. You can also specify your own id the moment you create the CKRecord. The it does not need to be a guid. As long as it's unique. Your save action will have a callback where you will get the ID.
Every user has it's own unique id which you can easily get. You could create a table with your blocking information. You only have to query for that yourself to implement the blocking mechanism.

Save the FourSquare Details locally in Iphone SDK

In my app, I integrated the Foursquare API to fetch the near by places.
I got the relevant code from Github
I send the request every time to fetch the near by places. But how can I save the places locally & display it without requesting all time if user has already visited the same place before.
You can use some sort of persistent datastore (either server-side or client-side) to save search results from Foursquare. You can save user check-in data (i.e., whether or not a user has visited a place) as well, but be aware that according to our policies, you can't save this data for more than 24 hours. If you want an up-to-date snapshot of whether or not a person has visited certain places, you're better off doing these queries on-the-fly instead of saving.

Which user data can be stored in my system apart from the Facebook ID?

I would like to know if I can store more data than a Facebook user id. In the old API it says no.
From ttp://developers.facebook.com/docs/ref … ndardinfo/:
The only storable values returned from this call are the user IDs.
But, could I store data if I do not relate it to the user? For instance: If the user is a woman, and rates something in my page, could I count a +1 women vote in my page without relating to the user?
That information is really old. Long ago Facebook changed the rules so you could "cache" any information 24 hours. Last year they then changed it so you could store it indefinitely. However, there are still rules on what that information can be used for. Look at the question "How long can I store data?" http://www.facebook.com/help/new/?page=1100
Now it's pretty much all based around permissions. Basic authorization gets you basic information about the user, based on their privacy settings. The user may not allow you to tell their gender. If you want more information, you need to prompt the user to grant you access to that additional information. Facebook has even setup a real time API for subscribing to user information changes. For example, you can get "alerted" if a user changes their gender (bad example).

Using GA Data Export API to Get All UA's

I am using the GA Data Export API to interact with Google Analytics and I'm making a lot of progress, I am using this URL Endpoint initially to pull all the profiles under an account:
https://www.google.com/analytics/feeds/accounts/default
This URL retrieves each GA ID (profile) and each UA. One thing I've realized is one account can contain multiple UAs and when this happens, this request pulls all profiles. We have a client who has about 115 profiles under like 10 different UAs, and the request takes about 30 seconds for the initial request (and then I believe it must be cached, because it speeds up considerably after this, but then the next day the same thing occurs).
Is there a way to get a list of UA's without pulling the profiles? This way I can query the UA specifically for the profiles instead of pulling each one.
Any advice on this would be really helpful!
Thanks
UPDATE: Here's some documentation on the specific call I am using right now:
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceAccountFeed.html
UPDATE 1: I have found some interesting information in the docs
Once your application has verified
that the user has Analytics access,
its next step is to find out which
Analytics accounts the user has access
to. Remember, users can have access to
many different accounts, and within
them, many different profiles. For
this reason, your application cannot
access any report information without
first requesting the list of accounts
available to the user. The resulting
accounts feed returns that list, but
most importantly, the list also
contains the account profiles that the
user can view.
So this means that you have to use the default accounts call to get these back? Surely, somebody has had this issue before?
So apparently, you can query the account if you know the UA-ID, however there is no way to get back a list of only UA IDs.
One way you can do it is have the user enter their own UA ID instead of having them choose one; not as user-friendly as it could be but better than making the user wait 30 seconds!