temporary database entries

22 views
Skip to first unread message

Colin Nolic

unread,
Jan 23, 2015, 8:54:20 AM1/23/15
to rubyonra...@googlegroups.com
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 ?

--
Posted via http://www.ruby-forum.com/.

Hassan Schroeder

unread,
Jan 23, 2015, 12:14:11 PM1/23/15
to rubyonrails-talk
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).

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

Colin Nolic

unread,
Jan 23, 2015, 12:53:09 PM1/23/15
to rubyonra...@googlegroups.com
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 hope I'm more clear this time.

Hassan Schroeder

unread,
Jan 23, 2015, 1:17:06 PM1/23/15
to rubyonrails-talk
On Fri, Jan 23, 2015 at 9:52 AM, Colin Nolic <li...@ruby-forum.com> wrote:

> 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.

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".

Colin Nolic

unread,
Jan 23, 2015, 1:41:56 PM1/23/15
to rubyonra...@googlegroups.com
I'm not used to web technologies and the different possibilities. I'll
examine further this solution.

Thank you Hassan Schroeder
Reply all
Reply to author
Forward
0 new messages