Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

部分KEY始终缓存失败 #68

Open
455586841 opened this issue Dec 17, 2013 · 2 comments
Open

部分KEY始终缓存失败 #68

455586841 opened this issue Dec 17, 2013 · 2 comments

Comments

@455586841
Copy link

我有如下两个KEY,上面这个总是缓存失败,而下面这个却总能成功;
CPI_DIC_null_com.tydic.cpi.sql.config.queryDictionaryInfo_1085713064_queryForList
CPI_DIC_null_com.tydic.cpi.sql.config.queryDictionaryInfo_1085713065_queryForList
两个KEY的不同点仅仅是1085713064和1085713065的最后一位数字,经过反复的测试发现还有很多Key存在此问题,全字母的KEY也存在类似的问题(CPI_DIC_asdasd_queryForList、sadasdasdasdasdsadweqw),因无法获取项目真实源代码,故无法得知问题原因,望尽快修复。
(memcached版本:2.5.3和2.6.6均存在;服务端:memcached-1.4.15.tar.gz)
测试代码如下:
public class TestMemcached {
public static void main(String[] args) {
SockIOPool pool = SockIOPool.getInstance();
String[] s = { "192.168.1.124:11211", "192.168.1.123:11211" };
Integer[] w = { 5, 5 };
pool.setServers(s);
pool.setWeights(w);
pool.setInitConn(Integer.valueOf(10 + ""));
pool.setMinConn(Integer.valueOf(10 + ""));
pool.setMaxConn(Integer.valueOf(1000 + ""));
pool.setMaxIdle(Integer.valueOf((1000 * 60 * 60) + ""));
pool.setMaintSleep(Integer.valueOf(60 + ""));
pool.setNagle(Boolean.valueOf("false"));
pool.setSocketTO(Integer.valueOf(60 + ""));
pool.setSocketConnectTO(Integer.valueOf(0 + ""));
pool.initialize();

    MemCachedClient mc = new MemCachedClient();
    //mc.setSanitizeKeys(true);
    //mc.setPrimitiveAsString(true);
    mc.flushAll();
    String key = "CPI_DIC_null_com.tydic.cpi.sql.config.queryDictionaryInfo_1085713064_queryForList";
    mc.set(key, new HashMap() {
        {
            put("test", 2);
        }
    }, 10000);
    System.out.println("value: " + mc.get(key));        
    //CPI_DIC_null_com.tydic.cpi.sql.config.queryDictionaryInfo_1085713064_queryForList
    //CPI_DIC_null_com.tydic.cpi.sql.config.queryDictionaryInfo_1085713065_queryForList
}

}

@JhonwillBao
Copy link

这个问题前两天XMemecache也遇到了

@xiaolu6t
Copy link

内部是hash取key.不同的key hash值相同是有可能的.对于memcahed本来就是单key操作.列表之类的还是用Redis吧.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants