Refreshing question
Mark Waddingham
mark at livecode.com
Wed Jul 12 12:28:43 EDT 2017
On 2017-07-12 18:23, jbv via use-livecode wrote:
> On Wed, July 12, 2017 5:34 pm, jonathandlynch at gmail.com wrote:
>> If the data is always the same, then I would update a page and have
>> the
>> browser read it.
>>
>> Are you looking to reload the whole page or just update a few data
>> points?
>>
>
> I really need to reload the xml data only, as the user will have the
> possibility to make some choices and changes on the page, and according
> to those changes, only some parts of the data will be displayed, or
> will be displayed in a different way...
I can see two main options:
1) If the data is expensive to recompute each time, or if you are
expecting the number of fetches (for all users) of the data to vastly
exceed the number of recomputations then you are probably better off
recomputing at a fixed interval in a cron job, and serving the computed
data statically.
2) If, however, the data is very cheap to recompute each time, or if you
aren't expecting the number of fetches (for all users) of the data to be
that much more frequent than the number of recomputations then you are
probably better off computing it on demand for a request.
There is a third option, which is essentially a combination of the 2 -
recompute lazily. If a request comes in and the data needs recomputed,
recompute it and ensure all other requests block and wait for it. Then
serve it statically to all requests.
Option (3) is probably the easiest (it has less 'moving parts'),
followed by (2) and then (3).
Note: If you need to selectively return data, based on the request, then
(2) is probably the best option.
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list