惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - ji yang

页面点击分析工具设计与实现 使用FreeMind代替PowerPoint做演示 Velocity 2011大会归来 通过扩展属性为SqlServer的索引添加注释信息 更安全的服务器:Windows账号权限修改监控 网站活跃用户统计的思路与设计 以服务的方式提供站点基础功能支持 safari的url地址转义问题 fastdfs dotnet 客户端发布 go lang web项目的部署与发布 从设计图到HTML页面时的注意点 关于加班 关于Google App Engine 一个简单的Spring.net绑定例子 SOA中国路线图活动感受 文章被转载了 Asp.net中基类页的设计和使用 产品营销上的求同策略
memcached对中文key的支持
ji yang · 2011-06-14 · via 博客园 - ji yang

默认的memcached客户端对非ANSI的key存取时会有
问题,这时可以有2种方式解决:

1 get和set前UrlEncode一下

2 修改memcached.config文件

<enyim.com>
  <memcached keyTransformer="Enyim.Caching.Memcached.SHA1KeyTransformer, Enyim.Caching">
    <servers>
      <add address="127.0.0.1" port="11211" />
    </servers>
    <socketPool minPoolSize="10" maxPoolSize="100"
        connectionTimeout="00:00:10" deadTimeout="00:02:00" />
  </memcached>
</enyim.com>

增加蓝色加亮部分即可。

基本的原理就是,客户端在get, set前,如果不指定keyTransformer,会把你的key字符串用Ansi Encode传递给memcached服务器,这时中文处理会有问题,如果指定了keyTransformer,如:SHA1KeyTransformer,就先计算一个sha1唯一值作为key,传递给memcached服务器,这样就可以避免中文Key的问题了。

更多说明,也可以看这儿的介绍:
http://blog.miniasp.com/post/2010/03/07/Let-Memcached-Provider-support-UTF8.aspx