[Catalyst] Serving "static" content from DB

Jason Galea lists at eightdegrees.com.au
Sun Jun 7 00:18:21 GMT 2009


The way I (and I assume many others) implement image thumbnails could be 
the way to go.. (unless you need the access control)

The server handles things as per any normal static content with a 404 
handler dealing with missing files. The handler creates and serves the 
file so any future requests for the same file are handled by the static 
server. To regenerate the file, simply delete it and it will be created 
the next time it's requested.

cheers,

J


Mihai Bazon wrote:
> Hi folks,
>
> I'm working on a simple CMS (actually started it for learning Catalyst,
> but the goal is to be able to maintain a few websites with it).  Each
> page is stored in DB and it can have file attachments, also stored in DB
> (content is BLOB).
>
> When serving an attachment, instead of always retrieving it from DB I
> want to save them in a cache directory.  So the first time a file is
> requested, it will be fetched from DB, saved in cache, then I want the
> Web server to do the job as if it were a static file.  With plain
> ModPerl, I would do it like this:
>
>   $r->filename($path_to_saved_file);
>   # plus some more hacks if it runs after PerlMapToStorageHandler
>   return Apache2::Const::DECLINED;
>
> I expect something similar will work with Catalyst using the ModPerl2
> engine, but I was wondering if I can do something that would work well
> with the development server and FastCGI as well.
>
> Thanks for any hints.
> -Mihai
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>   



More information about the Catalyst mailing list