<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>https://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>https://jackxiang.com/post//</link>
<title><![CDATA[[实践OK]统计redis中某类key的数量，代替keys指令]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Cache与Store]]></category>
<pubDate>Sat, 29 Dec 2018 07:44:37 +0000</pubDate> 
<guid>https://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	<textarea name="code" class="php" rows="15" cols="100">
SCAN 0 MATCH SESS_* COUNT 10
redis-cli -p 6401 -a X**--scan --pattern &quot;SESS*&quot;&nbsp;&nbsp;&gt; /tmp/10.71.1*.3*_SESS_KEYS_ALL.txt
</textarea><br/><br/><textarea name="code" class="php" rows="15" cols="100">
#!/bin/bash

A=$0
B=$&#123;A##*/&#125;
C=$&#123;B%.*&#125;
running_file_name=$C
running_flag=&quot;run.$running_file_name&quot;

REDIS_CLIENT=&#039;redis-cli -h 0.0.0.0 -p 6400 -x&#039;
function process &#123;
&nbsp;&nbsp;&nbsp;&nbsp;echo $0
&nbsp;&nbsp;&nbsp;&nbsp;index=-1
&nbsp;&nbsp;&nbsp;&nbsp;count=0
&nbsp;&nbsp;&nbsp;&nbsp;step=100000
&nbsp;&nbsp;&nbsp;&nbsp;while ((index!=0))
&nbsp;&nbsp;&nbsp;&nbsp;do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ $index -le 0 ];then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index=0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;scan $index match $1 count $step&quot; &#124; $REDIS_CLIENT &gt; $running_file_name.cache
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read index &lt;&lt;&lt; `head -1 $running_file_name.cache`
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read inc &lt;&lt;&lt; `cat $running_file_name.cache &#124; wc -l`
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inc=$((inc - 1))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ $? -ne 0 ];then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count=$((count + inc))
&nbsp;&nbsp;&nbsp;&nbsp;done
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;$1 count:&quot;$count
&#125;
#
if [ $# -ne 1 ];then
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;$0 &lt;pars&gt;&quot;
&nbsp;&nbsp;&nbsp;&nbsp;exit 0
fi
#
if [ -f &quot;$running_flag&quot; ] ; then
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;is running...&quot;
&nbsp;&nbsp;&nbsp;&nbsp;exit 0
fi
#
touch $running_flag
#
echo &quot;processing....&quot;
echo $*
process $*
#
rm -rf $running_flag
#
echo &quot;ok!&quot;

</textarea><br/><br/>./redis_keycount.sh &#039;SESS*&#039;&nbsp;&nbsp; <br/>processing....<br/>SESS*<br/>./redis_keycount.sh<br/><br/><br/><br/>SESS* count:21798578<br/>ok!<br/><br/>来自：https://studygolang.com/articles/14275?fr=sidebar
]]>
</description>
</item><item>
<link>https://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [实践OK]统计redis中某类key的数量，代替keys指令]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>