Coder Social home page Coder Social logo

wuce7758 / redic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eiasy/redic

0.0 2.0 0.0 21 KB

一个简单易用的Redis缓存客户端,与Spring无缝结合,简单导入Spring环境或者配置Redic Bean即可使用,并且支持读写分离和分片。

Java 100.00%

redic's Introduction

REDIC

一个简单易用的Redis缓存客户端,与Spring无缝结合,简单导入Spring环境或者配置Redic Bean即可使用,并且支持读写分离和分片。

##入门

单节点开发配置:

  1. 导入开发测试使用的Spring环境。
```
  1. 配置单节点属性

redic.cache.node.conn1=localhost:6379


***多节点线上配置:***

1. 在Spring环境中配置多节点的Redic Bean。

>``` xml
<bean id="redic" class="com.robert.redis.redic.Redic" init-method="init">
	<property name="nodeConnStrs">
		<list>
			<value>${redic.cache.node.conn1}</value>
			<value>${redic.cache.node.conn2}</value>
		</list>
	</property>
</bean>
  1. 配置单节点属性

redic.cache.node.conn1=localhost:6379 redic.cache.node.conn2=ip:6379


***多节点读写分离线上配置:***

1. 在Spring环境中配置多节点的Redic Bean。

>``` xml
<bean id="redic" class="com.robert.redis.redic.Redic" init-method="init">
	<property name="readWriteSeparate" value=${redic.cache.readWriteSeparate}>
	<property name="nodeConnStrs">
		<list>
			<value>${redic.cache.node.conn1}</value>
			<value>${redic.cache.node.conn2}</value>
		</list>
	</property>
</bean>
  1. 配置单节点属性

redic.cache.readWriteSeparate=true redic.cache.node.conn1=localhost:6379,localhost:6380 redic.cache.node.conn2=ip:6379,ip:6380


##TODO

1. 提供一种方式使用annotation来声明Redic,把连接节点,读写分离等属性放在annotation中声明,不用再使用spring环境。
2. 提供手工的失效转移,可提供后台控制台来提升某个从redis作为主。
3. 当前使用默认的对象池配置,需要进行压测以及调整。
4. 如果使用代理服务器,可以参考codis,codis类似mysql的cobar,中间多一层代理
5. 当前支持的时key-hash,节点有主从备,也可以考虑一致性hash,使用SharedPool来实现

redic's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.