またまた Blogger の仕様が元に戻りました?今日確認したら pre の中に br が入らなくなったようなので、以下の CSS を取り除きました。
pre.code br {
display: none;
}
どうせやるなら以下のような書き方のほうが Blogger 云々に右往左往しなくて良かったかも。
pre.code br+br {
display: run-in;
}
pre.code br {
display: none;
}
pre.code br+br {
display: run-in;
}
pre.code {
background: #eee;
border: 1px solid #ddd;
width: 95%;
padding: 5px;
font-size: 85%;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: auto; /* fix for long non-text content breaking IE sidebar float */
}
pre.code br {
display: none;
}
http://app.example.com/ (Apache)
↓
(リバースプロクシ)
↓
http://localhost:8080/app/ (Tomcat)
ProxyPath / http://localhost:8080/app
ProxyPassReverse / http://localhost:8080/
Set-Cookie: JSESSIONID=XXXXXXXXXXXXX; Path=/app
ProxyPath / http://localhost:8080/app/
ProxyPassReverse / http://localhost:8080/
ProxyPassReverseCookiePath /app /
Set-Cookie; JSESSIONID=XXXXXXXXXXXXX; Path=/
http://app.example.com/
http://localhost:8080/app/
RequestHeader set X-Context-Path ""
ProxyPath / http://localhost:8080/app/
ProxyPassReverse / http://localhost:8080/
ProxyPassReverseCookiePath /app /
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
doFilter((HttpServletRequest) req, (HttpServletResponse) res, chain);
}
public void doFilter(HttpServletRequest req, HttpServletResponse res,
FilterChain chain) throws IOException, ServletException {
// NOTE: X-Context-Path を受け取って、null で無ければその値を
// コンテキストパスとして使用する。
// ※実際は XSS などを埋め込まれないように文字列チェックする必要
// あります。
final String contextPath = req.getHeader("X-Context-Path");
if (contextPath != null) {
req = new HttpServletRequestWrapper(req) {
public String getContextPath() {
return contextPath;
}
};
}
chain.doFilter(req, res);
}
my $size = 1000;
my $cache = Cache::Memcached->new({
servers => ['localhost:11211'],
});
my $slabs = $cache->stats('slabs');
my @stat_ids = ();
for my $host (keys %{$slabs->{hosts}}) {
my $slabs_text = $slabs->{hosts}->{$host}->{slabs};
my @lines = split("\n", $slabs_text);
for my $line (@lines) {
($line =~ /STAT ([0-9]+):chunk_size [0-9]+/) or next;
push(@stat_ids, $1);
}
}
for my $stat_id (@stat_ids) {
my $cmd = "cachedump $stat_id $size";
print "[$cmd]\n";
my $cachedump = $cache->stats($cmd);
for my $host (keys %{$cachedump->{hosts}}) {
my $cachedump_text = $cachedump->{hosts}->{$host}->{$cmd};
my @lines = split("\n", $cachedump_text);
for my $line (@lines) {
($line =~ /^ITEM (.+) \[(.+) b; (.+) s\]/) or next;
my ($key, $b, $s) = ($1, $2, $3);
print "\t$key [$b bytes]\n";
}
}
}
> telnet localhost 11211
stats slabs
STAT 1:chunk_size 80
STAT 1:chunks_per_page 13107
STAT 1:total_pages 1
STAT 1:total_chunks 13107
STAT 1:used_chunks 13107
STAT 1:free_chunks 0
STAT 1:free_chunks_end 13065
STAT 2:chunk_size 100
STAT 2:chunks_per_page 10485
STAT 2:total_pages 1
STAT 2:total_chunks 10485
STAT 2:used_chunks 10485
STAT 2:free_chunks 0
STAT 2:free_chunks_end 10447
.....
STAT active_slabs 16
STAT total_malloced 16763844
END
stats cachedump {数字} {ダンプするキーの最大数}
ITEM {キー} [{統計情報}]
.....
END
# 中身も見ずにこういう呼び出しをしてしまってた。
$cache->stats('cachedump', 1, 100);
# こうすりゃ良かったんすね。
$cache->stats('cachedump 1 100');