카피 스트라 노 기본적으로,이 모든 모든 자산이 변경 및 브라우저 줘야 생각 레일을 배포 한 후 의미, 당신이 말한대로.에 '자산'을 고려 모든 파일을 터치 매번 새로운 버전을 다운로드하십시오.
다음 설정으로 카피스트라 노에서 이것을 비활성화 할 수 있습니다 :
set :normalize_asset_timestamps, false
SVN을 사용하는 경우 파일의 수정 날짜는 저장소에서 마지막으로 수정 된 날짜를 반영해야하므로 완벽해야합니다.
아파치를 사용하고 있다면, 이와 같은 것을 추가하여 실제로 캐싱을 할 수 있습니다. 이렇게하면 브라우저가 "캐시 제어"지시어에 의존하도록 알리는 데 도움이됩니다. 이는 캐시 된 자산을 알고있는 경우 캐시 요청을 요청할 필요가 없기 때문입니다.
#Etags should be based on the file parameters only (default includes INode)
FileETag MTime Size
#Rewrite stuff
RewriteEngine On
#This sets the environment variable (is_versioned) when the URL query string
#looks like ?874353948543 or any string of digits
RewriteCond %{QUERY_STRING} ^[0-9]+$
RewriteRule ^(.*)$ $1 [env=is_versioned:true]
<Directory /deployed-rails-app/public/ >
Options -Indexes FollowSymLinks -MultiViews
AllowOverride None
Order allow,deny
allow from all
#For files, force the browser to rely on cache-control directives and
#Rails asset timestamps by removing Etags and Last-Modified dates
#For all assets that aren't stamped by rails, cache them for ~ 3 hours
Header set "Cache-Control" "max-age=10000"
Header unset Etag
Header unset "Last-Modified"
#For all assets that ARE stamped by rails, cache them for 30 days
Header set "Cache-Control" "max-age=2592000" env=is_versioned
</Directory>
내 프로덕션 서버까지이 방법을 설정하고 현재 방문자는 동적 콘텐츠 및 모든 자산 (~ 40-50)을 반환 하나 개의 요청 (가져 오기 /)을 수행 반환 한 캐시됩니다.
레일 3.1에서 레일스는 타임 스탬프가 아닌 MD5를 사용하므로이 질문은 더 이상 의미가 없습니다. 2 년 전 –