Efficient ajax calls using flash?

Hey guys,

I do an ajax call to update a div in my view with a different partial.
The new partial uses data that was originally queried when the page was
loaded. It is kinda redundant to have to requery that record again.

Is the best solution to use flash to pass the result set. I guess, my
question is,

Does flash get stored on the client side, or on the server side.

If its only the client side then flashing would make sense.

On the other hand, if I am just requerying the database using the “ID”
field, isn’t that ultra fast and takes very little resources where it
wont matter if I just requery for that specific result?

In other words, is it worth using the select statement from a result
statement instead of requerying that specific item using find(id)?

Eric G. wrote:

Hey guys,

I do an ajax call to update a div in my view with a different partial.
The new partial uses data that was originally queried when the page was
loaded. It is kinda redundant to have to requery that record again.

Is the best solution to use flash to pass the result set. I guess, my
question is,

Does flash get stored on the client side, or on the server side.

If its only the client side then flashing would make sense.

On the other hand, if I am just requerying the database using the “ID”
field, isn’t that ultra fast and takes very little resources where it
wont matter if I just requery for that specific result?

The other option would be to store it in the session(not the flash -
that doesn’t stick around between requests), but if you’re using the
database as the session store, then it’s the same thing. You Could also
insert the ID or whatever you need to store into the AJAX params, that
way it would be “stored” in the HTML on the client machine.

1.) Neither Flash nor Session are stored on the client machine. They are
all
on the server.

2.) By default, rails stores session information on the filesystem. This
is
fine, unless you need to share sessions across servers in which case you
can
have Rails store session data in the database. It’s easy if you want to
go
that route. Google it.

3.) Yes, running a one-item query by ID is the easiest thing a DB server
can
do. Unless you want to do :select => ‘SQL_CACHE *’ which will do a
cached
query, thus increasing database speed as much as humanly possible.

Jason

Thanks for your response Jason.

So which route would you go in the case of ajax calls, would you flash
over the orginal result set? Or would you just pass the id and query
that from the database? Or is one way not really better than the other?

Im trying to build my app to be as scalable as possible.

What do you mean using the database as the session store? On this note,
is there any advantage to using flash with flash.keep across actions as
opposed to session? Is it less “resource intensive” or bulky to use
flash or does it not matter since its both stored on the clients
machine.

So Jason, what I understand from your response is that by storing the ID
and requerying that specific entry from the database using find is
really negligable as far as taking up database querying resources?

Jason N. wrote:

The other option would be to store it in the session(not the flash -
that doesn’t stick around between requests), but if you’re using the
database as the session store, then it’s the same thing. You Could also
insert the ID or whatever you need to store into the AJAX params, that
way it would be “stored” in the HTML on the client machine.