[Instantrails-users] Typo 2.6.0 new cache folder

David Morton mortonda at dgrmm.net
Thu Nov 17 13:42:16 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's my understanding of why things are the way they are:

Rails page caching is done by having rails generate the html page and depositing
them in the normal DocumentRoot of you web server.  When a cached page is hit,
it is a simple static page from the webserver... no rewriting is done (except to
add .html to the filename internally) and no scgi or rails code is even touched.
  This is accomplished via the rewrite rules:

RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /dispatch.cgi?$1 [QSA,L]

1 It maps the url to a .html file,
2 Tests if it exists,
3 and runs rails if it doesn't exist.  (that line was for fcgi, but it's the
same for scgi (with one caveat that is being worked on))

If you move the cache folder, then those files never exist, and page caching
will not work. (note: fragment and action caching are different and their cache
files are stored elsewhere. see:
http://api.rubyonrails.com/classes/ActionController/Caching.html )

You could move the DocumentRoot of your webserver to your cache directory, but
then you'd have to move everything else too, to no net change.

As for the site being frozen in time... When something changes, a sweeper
process goes through and deletes the files, forcing a fresh run of rails.

I saw some stale pages, but they always came up right when I held shift and
clicked reload.  I suspect the problem is that the web browser is caching the
file... so it's probably not a problem with rail.  check your production log in
log/ and you should see some mentions of sweeping; that is rails deleting the
stale cache files, and should happen whenever data changes.

Oh, on typo 2.6.0, there a clear cache on the admin page. :)


E Gard wrote:
> Hi David,
> 
> Currently, at the top of my cache folder are the following folders/files:
> 
> articles (folder)
> images (folder)
> stylesheets (folder)
> index.html
> 
> Before the change, like above, a cached index.html file was stored in
> the app's
> public folder and served up even when there were new posts to the blog.
> 
> It was driving me crazy, the site seemed to frozen in time.
> 
> This occurred back in Typo 2.5.6 and may not be the case any more.
> 
> Another thing I like about having ALL of the cache file in one place is
> that I can
> delete them by hand and not worry about deleting something needed by the
> blog.
> 
> I'm also going to add the cache folder to the list for no SCGI, just in case
> that might be an issue.  This may not be needed, but its my nature.
> 
> Please post any updates on the caching issues.  I'm not up to speed
> on the rewriting rules or apach! e, in general.  Love to learn more.


- --
David Morton
Maia Mailguard                        - http://www.maiamailguard.com
Morton Software Design and Consulting - http://www.dgrmm.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDfM8ISIxC85HZHLMRAgXiAJ46cVaWhFl4YusDVcGs5zlumGi8RgCeOHcl
4HZzr96Ohvbd5N5cZ53b6ck=
=PrR/
-----END PGP SIGNATURE-----


More information about the Instantrails-users mailing list