Configuring Rails Applications
Part 1 - Configuring Rails Components
이한국(@majestin)
2014. 04. 29(Tue)
config.asset_host
- http://fs0.rorlab.com/stylesheets/rorlab.css
- http://fs1.rorlab.com/javascripts/rorlab.js
- http://fs2.rorlab.com/images/rorlab_01.png
- http://fs3.rorlab.com/images/rorlab_02.png
config.action_controller.asset_host = “http://fs%d.rorlab.com"Helper method
<%= image_tag "rorlab_01.png" %>
<%= image_tag "rorlab_02.png" %>
==
<img src="http://fs2.rorlab.com/images/rorlab_01.png">
<img src="http://fs3.rorlab.com/images/rorlab_02.png">
Caching Store
| CACHING STORE | 내용 |
|---|---|
| FileStore | cache를 개별 파일에 저장하고 읽어온다. |
| MemoryStore | cache를 hash 변수에 저장하고 읽어온다. |
| MemCacheStore | memcache를 사용하여 저장하고 읽어온다 |
FileStore
각각의 cache를 개별 파일에 저장하고 읽어온다.
cache가 저장되는 곳 : tmp/cache
key = value 를 저장 : my_key = my_value!
->
실제 cache는 tmp/cache/my_key.cache 파일에
"my_value!" 라는 값이 쓰여집니다.
MemoryStore
MemoryStore는 일반적인 hash 변수에 cache를 저장하고 읽어옵니다.
FileStore와 같이 간편하게 사용할 수 있고, 빠릅니다.
하지만 마찬가지로 여러대의 app.server에서는 사용할 수 없습니다.
MemCacheStore
MemCacheStore는 여러 대의 memcache server를 이용해서 효율적인 caching 처리를 할 수 있습니다.
다음과 같이 서버 목록과 option들을 인수로 전달 받습니다.
# MemCacheStore 사용. 192.168.10.1:11211, 192.168.10.2:11212를 memcache server로 설정config.cache_store = :mem_cache_store, '192.168.10.1:11211′, '192.168.10.2:11212′, :namespace => 'rorlab'
Configuring Rails Applications Part 1
By hanguk lee
Configuring Rails Applications Part 1
- 839