Diesel-Engine Documentation

Diesel Object Caches    back to index
Introduction
Diesel Object Caches
The dsl2ops Program

Introduction    back to top

When Diesel-Engine executes a Diesel file, it needs to parse the Diesel-Script commands and the HTML. When the source file is parsed, Diesel-Engine creates a "parse tree" of the logic in the page. This parse tree is taken and executed apon to produce the dynamical page content.

The parsing of Diesel files is very quick, but is often the slowest step in the generation of the content. If the Diesel pages are not changing very often, it might seem a waste of resources to have to parse the same Diesel files for every request. Diesel addresses this with "Object Caches". Diesel can write out its "parse tree" into byte code. The byte code of all the pages in a site are then stored in a single flat file read-only database. Essentially, the entire site is parsed and the byte code is compiled into a single application file used to run the web application. When Diesel-Engine processes a request, the page is looked up in the application database and the Diesel byte code is loaded and executed.

Diesel Object Caches    back to top

A Diesel Object Cache is created by the 'dsl2ops' command line utility described in detail below. The utility creates a single file which contains an entire directory structure of Diesel pages, parsed into byte code and indexed in a read-only CDB database.

To configure Diesel-Engine to use a Diesel Object Cache, simply create a .htaccess file in the directory containing the 'diesel-ops.cdb' file. The contents of .htaccess is:

DieselOpsCache diesel-ops.cdb

The directory containing the 'diesel-ops.cdb' file must be in the web server document directory tree. Any Diesel file requested which resolves to a directory in or below the directory containing the 'diesel-ops.cdb' database file is matched against the database for a match. If found, the byte code in the database file is used (even if the actual file exists).

The dsl2ops Program    back to top

To create a 'diesel-ops.cdb' database file, use the command:

dsl2ops -r

in a directory containing Diesel files and other directories. Using the '-r' option, directories are recursively scanned and all Diesel files are parsed and will be saved in the database as byte code. It is not required to have the actual pages themselves present when using a Object Cache. The source files can be on one machine which produces a 'diesel-ops.cdb' file. This file contains the entire application and can be put on production web servers as the only content required to run the site (images included).

Copyright © 2005 Blueprint Networks, Inc.