|
13 | 13 | config.consider_all_requests_local = true |
14 | 14 |
|
15 | 15 | # Enable/disable caching. By default caching is disabled. |
16 | | - # Run rails dev:cache to toggle caching. |
| 16 | + # 运行命令: rails dev:cache 可以开启文件缓存。 |
17 | 17 | if Rails.root.join('tmp', 'caching-dev.txt').exist? |
18 | 18 | config.action_controller.perform_caching = true |
19 | 19 |
|
|
24 | 24 | else |
25 | 25 | config.action_controller.perform_caching = true |
26 | 26 | # config.cache_store = :null_store |
27 | | - config.cache_store = :redis_cache_store, CACHE_REDIS_CONFIG.merge({namespace: 'cache', compress: true, expires_in: 10.minutes}) |
| 27 | + # config.cache_store = :redis_cache_store, CACHE_REDIS_CONFIG.merge({namespace: 'cache', compress: true, expires_in: 10.minutes}) |
| 28 | + config.cache_store = :redis_store, "redis://localhost:6379/2/cache", { expires_in: 90.minutes } |
| 29 | + # config.cache_store = :redis_cache_store, {driver: :hiredis, namespace: 'cache', compress: true, |
| 30 | + # timeout: 1, url: "redis://127.0.0.1:6379/2"} |
28 | 31 | end |
29 | 32 |
|
30 | 33 | # 配置http缓存 |
| 34 | + redis_password = CACHE_REDIS_CONFIG[:password].present? ? ":#{CACHE_REDIS_CONFIG[:password]}@": "" |
| 35 | + metastore_redis_config = "redis://#{redis_password}#{CACHE_REDIS_CONFIG[:host]}:#{CACHE_REDIS_CONFIG[:port]}/#{CACHE_REDIS_CONFIG[:db]}/metastore" |
| 36 | + entitystore_redis_config = "redis://#{redis_password}#{CACHE_REDIS_CONFIG[:host]}:#{CACHE_REDIS_CONFIG[:port]}/#{CACHE_REDIS_CONFIG[:db]}/entitystore" |
31 | 37 | config.action_dispatch.rack_cache = { |
32 | | - metastore: CACHE_REDIS_CONFIG.merge({namespace: 'metastore'}), |
33 | | - entitystore: CACHE_REDIS_CONFIG.merge({namespace: 'entitystore'}) |
| 38 | + metastore: metastore_redis_config, |
| 39 | + entitystore: entitystore_redis_config |
34 | 40 | } |
35 | 41 |
|
36 | 42 | # Store uploaded files on the local file system (see config/storage.yml for options) |
|
0 commit comments