[Catalyst] Serve blob files into src="" type tags

A. Pagaltzis pagaltzis at gmx.de
Sun Mar 12 02:54:01 CET 2006


* apv <apv at sedition.com> [2006-03-11 22:50]:
>The reason I'm moving away from it is I want a "site" to be its
>database + its Catalyst app. Not the database + 50 assorted CSS
>and JS files + several hundred or even several thousands of
>images which may have been twiddled, moved, and renamed manually
>without letting the database know that the record it pointed to
>is now hopelessly "corrupt."

Putting the files in the filesystem does not mean giving them
human-meaningful names and/or putting them in arbitrary places.
The only requirement is that your code know how to map URIs to
files. F.ex. you could use some sort of hash value as the
filename in a two- or three-level directory structure; the
typical layout of a cache. Such an opaque structure will
discourage anyone from getting frisky with it. Serving the files
would require mapping incoming URIs to hashed filenames via the
database, but that is lightweight, and once done, the rest of the
request consists of stuffing the file down the wire straight from
disk.

Then you’d have sites which consist of a database, a blob cache
dir and the Cat app.

For JS and CSS, of course, there’s no reason not to store them in
the database; those are never more than a couple KB, and database
engines deal with that easily. You just don’t want to go around
stick megabyte-size blobs in there or it’ll end in tears.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list