FastCGI binding or implementation?
    Jacob Carlborg 
    doob at me.com
       
    Wed Oct 19 09:24:29 PDT 2011
    
    
  
On 2011-10-19 16:36, Adam Ruppe wrote:
> Jacob Carlborg:
>> Why not just cache the generated HTML and let Apache handle it.
>
> That sounds hard... configuring Apache to do anything beyond the most
> trivial of tasks is a huge pain to me.
No, it's not that hard. Just add a couple of rewrite-rules that checks 
if a request matches an already cached page and rewrite it to the cached 
page. Something like this:
</VirtualHost *:80>
   ...
   RailsAllowModRewrite On
   RewriteEngine On
   RewriteCond %{THE_REQUEST} ^(GET|HEAD)
   RewriteCond %{REQUEST_URI} ^/([^.]+)$
   RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
   RewriteRule ^/[^.]+$ /cache/%1.html [QSA,L]
   RewriteCond %{THE_REQUEST} ^(GET|HEAD)
   RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
   RewriteRule ^/$ /cache/index.html [QSA,L]
</VirtualHost>
I found the above at:
http://www.alfajango.com/blog/make-sure-your-rails-application-is-actually-caching-and-not-just-pretending/
> It is easy to call "cgi.setCache(true);" though.
>
>> Then it doesn't even need to start the application if the cache is
>> available.
>
> It's better with a client side cache. If it's available, you don't
> have to go to the server at all!
Yes of course, that is preferred.
> Server side caching is something I haven't done yet; it's never
> been useful to me.
-- 
/Jacob Carlborg
    
    
More information about the Digitalmars-d-learn
mailing list