(For gurus) Embed functions in webpages like in PHP?

Robert Ferber rob at nospam.net
Sat Apr 17 06:42:49 EDT 2004


Thomas Guettler wrote:

> Am Fri, 16 Apr 2004 12:38:16 +0200 schrieb Robert Ferber:
> 
>> Hi,
>> 
>> I'm  a PHP-programmer who evaluates Python for a new project.
>> I really like a lot of concepts of Python, especially the shell, but
>> there is one great feature of PHP which I don't know how to replace in
>> Python:
>> 
>> For database-intensive webpages, I like to cache the HTML-output on the
>> fly in the filesystem and put out the file later whenever the same URL is
>> requested again, for example:
> 
> The problem with caching: When is
> the data outdate?

Currently I just use the file creation date. I set it for example 2 weeks
into the future and whenever the creation date is in the past it is
assumend out of date.

> You could use this approach:
> Run a cron-job every hour which does the complicated
> query which needs long to compute. Dump
> the result into a file (Look for "pickle"
> in the module index of the docs).

That wouldn't work, in fact it would make matters worse.

First of all, I couldn't have different times for caches to get out of date,
then, more importantly, I'd have to run it for every possible combination
at once, for example for script.php?a=1&b=2&c=3, I'd have to do all
combinations for a, b and c which could lead to thousands, sometimes
millions of combinations.
Also, there is no way to know which values of a, b and c are even possible,
so I wouldn't even know what to generate.


-- 
Harte Arbeit zahlt sich später mal aus. Faulheit sofort!




More information about the Python-list mailing list