Caching

Just finished up a bunch of work on the caching extension, which required some reworking of init.php and foundry.php.

I’m trying to keep the caching extension as simple as possible. It will do a few clearly defined tasks:
* save the output buffer
* check the output buffer
* return 304 if saved buffer hasn’t been modified since the client last downloaded it
* return the output buffer

It will also send headers specified in sitemap gate attributes. The sitemap structure is getting a little wacky, but it works! For example, let’s examine this gate:

    <map:gate name="dynamic-css"
      cache="600"
      nosession="true"
      content_type="text/css"
      cache_control="public, max-age=600, must-revalidate"
      >
        <map:action type="header" params="Content-type,text/css"/>
        <map:action type="header" params="Cache-Control,public; max-age=300; must-revalidate"/>
        <map:xsl src="templates/css/dynamic.css.xsl"/>
    </map:gate>

Why repeat content type and cache control? I can’t think of another way at the moment, and its not a big deal. Perhaps init should natively handle headers. For now, I think its *OK*, but if there is substantial need for expansion, we’ll re-factor.

Explanation:
The gate name is basically the url, the cache is the number of seconds the cached file will be good for, nosession causes init to omit any session_start calls, content-type is to make sure the header is sent, even when a cached file is output instead of the gate getting processed (which should perhaps simple be sent by init), and the same with cache_control.

I’ll have to think about that. Using gate attributes to specify http headers for init to send. Maybe not…. I don’t want to muck up init with too many non-essentials. In a way that already has happened due to the info array which is built in the compiled sitemap… hmmm.

Nexista Sessions

Authentication, caching, and sessions are all related, so the need to abstract out session management in Nexista has been a priority for awhile. Today it became a reality. The code is very new so I’m sure I’ll find issues with it, but so far I’m quite pleased.

There is a hook to use PEAR’s HTTP_Session2, as well as a way to use memcached, if the extension is available.

I’ve also added a gate attribute, nosessions, to override the configuration setting. This is nice for semi-static output like dynamic css, and other public data.

Like I said there is still a bunch to do, but the basics are there. Some to-dos include:
* Auth extension as a default instead of a separate application
* Clarify limitations of session controls available from configuration, clearly delineate how sessions affect caching and authentication.

Nexista 0.2.3




Nexista 0.2.3 is out! I’ve just added it to the PEAR channel, as well as tagged and branched it in the subversion repository.

The 0.2.x branch is really starting to shape up. Its been getting much more stable and flexible, so I may end up moving a lot of the newer work I’ve been working on to a 0.3.x branch. Thoughts?

Note to self: The documentation needs to be updated!

Closer to PEAR Compliance…

I’ve been working with the very cool PHP Codesniffer package, using it to clean up the Nexista codebase. I’m pleased to report that its been very helpful it getting Nexista up to snuff so far. Its been a quality learning experience for me, helping me understand why some code is formatted certain ways.

If you haven’t tried it, you might like it!

Major Changes




If you are using Nexista SVN, you may want to hold off on updating. The entire codebase is going through some significant changes, so hold tight. I’m going to try to update all the apps that I manage which use Nexista, as well as conclude the volatility ASAP. Thanks for your patience.

Probably the most significant change is the way handlers work. They now use sitemap files as the relative path root for resources that are loaded inside of it. This is a big change for the better! If your config no longer works, change the sitemap directive from config/sitemap.xml to just sitemap.xml.

Second to that is the fact that all queries which return multiple rows are now enclosed in a parent node of the same name instead of the root node. This should make for more efficient document traversal, and better organization of info overall.