Hello,
I just had this idea about easy caching in CGI::Application and wanted
to share some ideas.
The core concept is that run modes could marked as cacheable with simple
attributes:
sub run_mode_name : Cacheable('10 min') {
# your run mode here
}
The first time the run mode is called, it would really run.
For the next 10 minutes, a cached page would be returned.
Further, every time the run mode is activated, the appropriate headers
would be added to allow browser-side caching as well.
This could be useful for complex reports, but would probably be the
Wrong Solution if the query string or cookie could affect the outcome.
There would also be a "config_caching()" method that could be used in
setup or cgiapp_init to set up details for which backend and storage to
use.
Some other ideas:
- a global option to mark all run modes as cacheable
- a global option to turn off caching, which makes debugging easier.
These are just brainstorms. I don't claim to be an expert on website
performance or caching. (And I haven't done any benchmarking about
run-mode level caching versus just caching expensive DB queries).
One thing I have noticed though: Even if the database and templating
engines are fast enough, under heavy load it's possible to run out of
database connections.
Caching could shift the load of the identical database queries being run
repeatedly.
Perhaps making caching easy in this way is the wrong solution because it
could encourage over-engineering which may actually slow down the common
case, instead of adding extra performance the few specific cases where
it's actually needed.
Mark
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]