After posting this question
page cache more than 100K files inside a single directory? http://www.ruby-forum.com/topic/108450#new
I’ve been look into how page caching works.
Now I’ve rewritten page_cache_file(path) (Module
ActionController::Caching::Pages::ClassMethods). now it will divide
page_cache files into subdirectories to avoid more than 10K files to be
stored inside a single directory. (788.html-> 0/788.html; 79780.html->
7/9780.html).
But since the default save path being changed, rails generate the
content from database ignoring the cached files.
so, I need to let rails know that cache files’ location are changed
Digging for hours, I couldn’t get any idea on how rails check and fetch
page cache files.
But since the default save path being changed, rails generate the
content from database ignoring the cached files.
so, I need to let rails know that cache files’ location are changed
Digging for hours, I couldn’t get any idea on how rails check and fetch
page cache files.
Can anyone give me a clue?
It doesn’t. Your web server’s rewrite routes need to be written in a
way that it checks for the existence of a file and serves it before
even bothering rails. This is static-heavy sites like the main Rails
site and weblog are blazing fast. Apache’s doing the heavy lifting.
still knew the cache files. It let me believe that the job was done
inside the rails…
so I was wrong…
Mongrel does the same thing too. When in doubt, watch your logs for
rails requests.
Now I’ll try to use apache’s httpd.conf file. It surely can redirect to
cache file.
Before that, I need to learn complex rewrite rule for mod_rewrite…
If you’ve done this before, can you give me a quick help?
I need a apache mod_rewrite rule to rewrite
/data/98 to /data/0/98.html
and
/data/89798 to /data/8/9798.html
(/data/:id, ids are divided into two parts, four digitals for file name,
left will be dir name.)
Why not just use the partitioned IDs in the rails routes themselves?
Your web server’s rewrite routes need to be written in a
way that it checks for the existence of a file and serves it before
even bothering rails.
I’d tried to remove
RewriteRule ^([^.]+)$ $1.html [QSA]
from public/.htaccess, but mongrel(development env, without apache)
still knew the cache files. It let me believe that the job was done
inside the rails…
so I was wrong…
Now I’ll try to use apache’s httpd.conf file. It surely can redirect to
cache file.
Before that, I need to learn complex rewrite rule for mod_rewrite…
If you’ve done this before, can you give me a quick help?
I need a apache mod_rewrite rule to rewrite
/data/98 to /data/0/98.html
and
/data/89798 to /data/8/9798.html
(/data/:id, ids are divided into two parts, four digitals for file name,
left will be dir name.)
finally, I come up with these rewrite rule:
RewriteRule ^([^.]+)/(\d{1,4})$ /$1/0/$2.html [QSA]
RewriteRule ^([^.]+)/(\d+)(\d{4,})$ /$1/$2/$3.html [QSA]
will them work?
I need a apache mod_rewrite rule to rewrite
/data/98 to /data/0/98.html
and
/data/89798 to /data/8/9798.html
(/data/:id, ids are divided into two parts, four digitals for file name,
left will be dir name.)