Hi !
I’m using an external api (themoviedb) to retrieve movies informations.
The user type the name of the movie, the application fetch a list of
movies. Then the user pick the right movie from the list and the movie
is saved to the database.
I don’t know much about redis but I wonder if using redis for
temporarily store the list of movies and then store the right movie
(chosen by the user) to postgres database ?
Or maybe there is a better way to acheive my goal ?
I’m using an external api (themoviedb) to retrieve movies informations.
The user type the name of the movie, the application fetch a list of
movies. Then the user pick the right movie from the list and the movie
is saved to the database.
I don’t know much about redis but I wonder if using redis for
temporarily store the list of movies and then store the right movie
(chosen by the user) to postgres database ?
Or maybe there is a better way to acheive my goal ?
What is your goal? The scenario described doesn’t require you to
“store” the movie list anywhere.
Do you need to insure a fresh list every time? If not, then yes, some
kind of local storage makes sense, either volatile (e.g. memcached)
or persistent (e.g. redis).
Right, I don’t need to store the list of movies in the database.
Here is the scenario:
1 - The user search a movie by the name
2 - I render a list of movies with various informations (like director,
actors) fetched from the external API. And yes I need the list to be
fresh every time.
3 - The user pick a movie from the list
4 - I store the informations, of the movie the user choose, in the
database so the user can consult these informations latter.
I’m stuck on how to achieve the step 4.
I could make another request to the API for the selected movie but I
want to minimize API’s requests.
I could extract movie details from the view. I don’t know if it’s
truly possible but I doesn’t seem quite right anyway.
I could store the movie details from the step 2 and delete all
informations I don’t need latter.
I could use volatile memory to store movie details from step 2, and
then store the movie the user choose in the database.
I thought the latest option was the more appropriate.
I could make another request to the API for the selected movie but I
want to minimize API’s requests.
I could extract movie details from the view. I don’t know if it’s
truly possible but I doesn’t seem quite right anyway.
I could store the movie details from the step 2 and delete all
informations I don’t need latter.
I could use volatile memory to store movie details from step 2, and
then store the movie the user choose in the database.
You’re writing all this data to a view anyway; why not just make each
entry a form with that movie’s data? Choose, click button, submitted
and done. No additional API call, no need for temporary “storage”.