Mat*_*ham 2 ruby memcached ruby-on-rails heroku
我试图将我的大脑包裹在Rack :: Cache,Rails 3.2,Memcache和Heroku中.我想我已经完成了所有工作,如下所述:http://myownpirateradio.com/2012/01/01/getting-heroku-cedar-and-rails-3-1-asset-pipeline-to-play -nicely在一起/
总而言之,我不确定Memcached是否真的在做它应该做的事情.有没有办法在Memcached上获取统计信息或查看Memcached是否缓存了请求?我将当前时间放在页面上,并且可以看到它正在缓存(标题看起来也很好),但我怎么知道它与Memcached一起使用,而不是文件存储?
谢谢.
您可以通过执行以下操作获取memcached的统计信息:
$ heroku run console
Running console attached to terminal... up, run.1
Loading production environment (Rails 3.1.3)
irb(main):001:0> Rails.cache.stats
Dalli/SASL authenticating as app590983%40heroku.com
Dalli/SASL: Authenticated
=> {"mc5.ec2.northscale.net:11211"=>{"evictions"=>"0", "curr_items"=>"627",
"total_items"=>"1257", "bytes"=>"2294318", "reclaimed"=>"0",
"engine_maxbytes"=>"5242880", "bucket_conns"=>"2", "pid"=>"319",
"uptime"=>"6710022", "time"=>"1330731177", "version"=>"1.4.4_207_g19c6b9e",
"libevent"=>"1.4.11-stable", "pointer_size"=>"64",
"rusage_user"=>"34354.590000", "rusage_system"=>"31381.520000",
"daemon_connections"=>"10", "curr_connections"=>"1211",
"total_connections"=>"14127919", "connection_structures"=>"1764",
"cmd_get"=>"9476", "cmd_set"=>"1257", "cmd_flush"=>"0", "auth_cmds"=>"24",
"auth_errors"=>"0", "get_hits"=>"8093", "get_misses"=>"1383",
"delete_misses"=>"0", "delete_hits"=>"0", "incr_misses"=>"0",
"incr_hits"=>"0", "decr_misses"=>"0", "decr_hits"=>"0", "cas_misses"=>"0",
"cas_hits"=>"0", "cas_badval"=>"0", "bytes_read"=>"21983909",
"bytes_written"=>"85267718", "limit_maxbytes"=>"67108864",
"rejected_conns"=>"0", "threads"=>"4", "conn_yields"=>"0"}}
Run Code Online (Sandbox Code Playgroud)
PS:我认为您可能需要使用Dalli gem来实现这一点,但无论如何,这是推荐的客户端.
您还可以运行Rails.cache.class以查看使用Rails的后端.
| 归档时间: |
|
| 查看次数: |
1719 次 |
| 最近记录: |