Re: [Catalyst] RFC: file/path writing sub-class of Catalyst::Plugin::Static::Simple
Kieren Diment wrote: [snipped prior correspondence] I'm not sure, because systems architecture is really not my thing, but this sounds like something you might describe as Catalyst::Plugin::Cache::Static - which would render a template into a variable and serve off an appropriate path for the webserver to deal with. Kind of like PageCache, but designed to totally bypass catalyst for read-only docs. This is exactly what Apache's mod_cache does. It fetches the page once (from Catalyst), and then stores it until it expires (set in the headers). The caching is URL based, but by cleverly applying mod_rewrite you can have it account for cookies, etc. Docs are here: http://httpd.apache.org/docs/2.2/mod/mod_cache.html Maybe this would be a good advent calendar topic? Regards, Jonathan Rockway -- package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do { $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //, ;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup; ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] RFC: file/path writing sub-class of Catalyst::Plugin::Static::Simple
I'm probably about to write a sub-class of Catalyst::Plugin::Static::Simple which writes the file to disk on the first request. The reason is I like to have all my extra static files (images, media, css, etc) in the same bundle as the application but I also want to let Apache serve them, obviously. So I can either try to keep a tree sync'd between my app path and my webserver path or do this so the authoritative versions in the app path are written to disk on first request. (Semi-)Permanent cache. Do you think this is something useful enough to also put on the CPAN? Other feedback? Name? Catalyst::Plugin::Static::DiskWrite? The idea is not to be able to check for freshness or other cache-like behavior but to write it if it's not there and leave it at that. Used with things like: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*) /index.fcgi/$1 [QSA,L] Thanks! –Ashley -- ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RFC: file/path writing sub-class of Catalyst::Plugin::Static::Simple
apv wrote: I'm probably about to write a sub-class of Catalyst::Plugin::Static::Simple which writes the file to disk on the first request. The reason is I like to have all my extra static files (images, media, css, etc) in the same bundle as the application but I also want to let Apache serve them, obviously. So I can either try to keep a tree sync'd between my app path and my webserver path or do this so the authoritative versions in the app path are written to disk on first request. (Semi-)Permanent cache. Do you think this is something useful enough to also put on the CPAN? Other feedback? Name? Catalyst::Plugin::Static::DiskWrite? The idea is not to be able to check for freshness or other cache-like behavior but to write it if it's not there and leave it at that. Used with things like: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*) /index.fcgi/$1 [QSA,L] Can you not just do: Alias /static /path/to/my/app/static In your Apache (or whatever) config? ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RFC: file/path writing sub-class of Catalyst::Plugin::Static::Simple
On Nov 26, 2006, at 2:01 PM, Ash Berlin wrote: apv wrote: I'm probably about to write a sub-class of Catalyst::Plugin::Static::Simple which writes the file to disk on the first request. The reason is I like to have all my extra static files (images, media, css, etc) in the same bundle as the application but I also want to let Apache serve them, obviously. So I can either try to keep a tree sync'd between my app path and my webserver path or do this so the authoritative versions in the app path are written to disk on first request. (Semi-)Permanent cache. Do you think this is something useful enough to also put on the CPAN? Other feedback? Name? Catalyst::Plugin::Static::DiskWrite? The idea is not to be able to check for freshness or other cache-like behavior but to write it if it's not there and leave it at that. Used with things like: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*) /index.fcgi/$1 [QSA,L] Can you not just do: Alias /static /path/to/my/app/static In your Apache (or whatever) config? Hm… I could but I'm not smart/awake enough to think to try it first. Sigh! I realize now that when I was doing this idea previously (manually from and end) it was using templates so the content was dynamic but rarely changing. I'll rethink the whole thing. Thanks, man. -Ashley ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RFC: file/path writing sub-class of Catalyst::Plugin::Static::Simple
[snipped prior correspondence] I'm not sure, because systems architecture is really not my thing, but this sounds like something you might describe as Catalyst::Plugin::Cache::Static - which would render a template into a variable and serve off an appropriate path for the webserver to deal with. Kind of like PageCache, but designed to totally bypass catalyst for read-only docs. For my thinking the logic might go soemthig like this: low trafic dynamic web applicaiton at http://localhost:3000 (or anywhere else you can deploy to) which creates pages (I guess you'd have to modify the login and edit links if they existed for the staitc version with some template conditionals) and saves them off to /var/www/myapp/path_to/wherever/index.html every time there's an update. Is this the kind of thing you had in mind? ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/