【理财整站源码】【汽车贴膜小程序源码怎么找】【云端工具箱小程序源码错误】algo源码
1.完整的源码理财整站源码C++库函数源代码哪里有?
2.STL 源码剖析:sort
3.php-beast 解密与加密 操作过程(详细)
4.UE 打包引擎源码
5.jedis å strpin-data-redis åªä¸ä¸ªå¥½
完整的C++库函数源代码哪里有?
去官网吧
blogs.com/KisonDu/p/1... iOS和tvOS开发要求 打包插件必须安装vs ? github.com/EpicGames/Un...
jedis å strpin-data-redis åªä¸ä¸ªå¥½
ä¹åä¸ç´æ²¡ä»ç»çè¿ShardedJedisç代ç ï¼æè¿éå°äºshardåé群æ©å®¹åçæ°æ®è¿ç§»é®é¢ã
ä»å¤©å¨çShardedJedisæºç çæ¶åï¼åç°ShardedJedis并没æ使ç¨èç¹çIpåportåhashï¼èæ¯ç¨çinstanceç顺åºæè nameï¼å¤ªèµäºã
private void initialize(List<S> shards) {
nodes = new TreeMap<Long, S>();
for (int i = 0; i != shards.size(); ++i) {
final S shardInfo = shards.get(i);
if (shardInfo.getName() == null)
for (int n = 0; n < * shardInfo.getWeight(); n++) {
nodes.put(this.algo.hash("SHARD-" + i + "-NODE-" + n),
shardInfo);
}
else
for (int n = 0; n < * shardInfo.getWeight(); n++) {
nodes.put(
this.algo.hash(shardInfo.getName() + "*"
+ shardInfo.getWeight() + n), shardInfo);
}
resources.put(shardInfo, shardInfo.createResource());
}
}
é ç½®çæ¶åä¹é常ç®å:
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value=""/>
<property name="maxIdle" value=""/>
<property name="minIdle" value="1"/>
<property name="maxWaitMillis" value=""/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="true"/>
<property name="testWhileIdle" value="true"/>
</bean>
<bean id="shardedJedisPool" class="redis.clients.jedis.ShardedJedisPool" destroy-method="destroy">
<constructor-arg ref="jedisPoolConfig"/>
<constructor-arg>
<list>
<bean class="redis.clients.jedis.JedisShardInfo">
<constructor-arg value=".0.0.1"/>
<constructor-arg type="int" value=""/>
<constructor-arg value="instance:"/>
</bean>
<bean class="redis.clients.jedis.JedisShardInfo">
<constructor-arg value=".0.0.1"/>
<constructor-arg type="int" value=""/>
<constructor-arg value="instance:"/>
</bean>
<bean class="redis.clients.jedis.JedisShardInfo">
<constructor-arg value=".0.0.1"/>
<constructor-arg type="int" value=""/>
<constructor-arg value="instance:"/>
</bean>
</list>
</constructor-arg>
</bean>
ä¸å¼å§ä½ å¯ä»¥è®¾ç½®è¶³å¤å¤çinstanceï¼æ°æ®æ©å®¹çæ¶åï¼åªéè¦å°å 个instanceçæ°æ®copyå°å«çæºå¨ä¸ã
ç¶åä¿®æ¹é ç½®æ件çipå端å£å³å¯ãå¾æ¹ä¾¿å§ï¼
å¦å¤ï¼Jedisè¿æä¾äºå¯¹jedis sentinel poolçå°è£ ï¼æ以åç主ä»åæ¢çæ¶åï¼web serveré½ä¸éè¦éæ°é ç½®ådeployãé«å¯ç¨æ§çæä½³ä½ç°åã
@Autowired private JedisSentinelPool pool;
public void mymethod() {
Jedis jedis = null;
try {
jedis = pool.getResource();
jedis.hset(....
} catch (JedisException je) {
throw je;
} finally {
if (jedis != null) pool.returnResource(jedis);
}
}
spring beançé ç½®ï¼
<bean id="redisSentinel" class="redis.clients.jedis.JedisSentinelPool">
<constructor-arg index="0" value="mymaster" />
<constructor-arg index="1">
<set>
<value>hostofsentinel:</value>
</set>
</constructor-arg>
<constructor-arg index="2" ref="jedisPoolConfig" />
</bean>