SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)

    Front end doesn't touch database

    Hi,

    I'm not sure whether this is a Design Pattern or something else, just interested to hear some feedback on the idea,

    In my Organisation, the front end of the website doesn't have any interaction with the database what-so-ever.

    This is achieved by a series of 'writer files' that basically read from the the database and spit out a file on the server - this file is then included in the pages via SSI.

    When a change is made to the database in the back end Administration Area, the appropriate writer files are called like:
    Code:
    fclose(fopen($writer,"r"));
    And then these scripts.. writes the files!

    This means a much faster loading and secure front end of the website, a good idea - or convoluted? I think it's done pretty well and now that we're using a kind of templating system for the writers it's done very cleanly. It makes global changes to the website possible without losing speed.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That's a pretty strange way to implement a cache.

  3. #3
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    It seems like much more than a cache to me..

    I'm more tempted to call it a design pattern, I wasn't sure if was a common structure, I suppose from your response that its not and you haven't seen it before.

    It makes perfect sense to me now i'm familiar with the concept - and the benefits seem quite large. So... you think it's a bad idea?

    Give it a while - it may grow on you..
    Last edited by markbrown4; Jul 9, 2007 at 22:53.

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That technique is sometimes referred to as "baking". It's a very efficient way to do content management, but obviously works well with mostly static content.

  5. #5
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    @markbrown4 - funny you should describe that - I just made a CMS add-in that did exactly with the database driven part of various pages.

    It just seemed a simple and logical answer, no idea it had a term 'baking'.

    It was for reporting local election results, at the instant an individual result was declared I used a bunch of Observers to carry out several tasks. One was to query the db, work out the percentage change in votes etc and then 'bake' ( ) an include file, the individual result was then picked up and reused on plasma screens at count centres, on website etc.

    Worked really nicely, glad I can give it a name now ...

  6. #6
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  7. #7
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Writing input to a file then write to the database, isn't that an extra step?

  8. #8
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    It's the other way around usually, but yes.
    Writing the files is an extra step in the back-end of the system, but it's a lot less work on the server on the front end of the system(which should have a far greater number of hits) - so it makes the whole thing much faster.

    Thanks very much for the info kyberfabrikken, i'm all enlightened now

  9. #9
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    Norway - Oslo
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We use this some places, and some places we use regular caching. This makes sense for static data that you can timely update once every hour etc. If the data have to be live when using a special request i wouldnt do this. Mostly we use this for some aggregated object collections that hardly changes.

    Imo a good technique at times, specialy when the only updates should happen when someone hit a button in the admin panel.
    Raymond Julin
    Developer: Hardware.no, Amobil.no, Gamer.no, Prisguide.no ...
    Owner: Kulturo.no


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •