When designing a website, I find it mentally less challenging to use a database as opposed to a database + bunch of files. For example, if I have a table called PLAYER then I prefer to have all aspects of that player centralizedin a table instead of say, having the players picture on disk somewhere and having the player's name as a column in the table. This to me has many advantages:
  1. Creating a new player is not a hybrid task of adding a database row and managing a file hierarchy for him
  2. I dont have to keep track of two different access policies
  3. of course player deletion is fairly straightforward too.
Now the disadvantage is that it is much harder to get the client to cache image data (say of the player's picture) when I am serving it out of a database based on a query string instead of when the browser is making a call to the full URL to the image.

Is there an easy way to recoup the two? One thing which comes to mind is path translation:

http://www.website.com/user/bobo/pic/file.jpg
really gets served by an Apache handler ala:
SELECT pic FROM player WHERE username = 'bobo';
but I dont have the luxury of such a handler because I am being hosted somewhere where I only have CGI access.

In reply to (webappdev) database centralization ease + client-side file caching? by princepawn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.