Write your own Redis client [deerlet-redis-client], share and recruit.

Source: Internet
Author: User
Tags redis server


Introduction





There is a need to use Redis at work recently, so I have a whim to write a Java client. After two days of effort, the client is now basically molded. Unfortunately, because of the number of REDIS commands, the LZ also needs to slowly expand it to support more commands.





Share





This article only two purposes, the first is to share, since is sharing, naturally is to share the source code. LZ has been the source code to github up, you can go to LZ GitHub on the source, the project name is Deerlet-redis-client.



Next is the LZ "alarming" prepared a set of project introduction. Please have a look, as shown below.



---------------------I'm a split line---------------------------


Deerlet-redis-client


Deerlet is an easy-to-use Redis for Java client that supports seamless integration with spring.


Characteristics


1, lightweight, jar package only 25kb.
2, easy to use, non-invasive.
3, can be seamlessly integrated with the current popular IOC container spring.
4,API is fully consistent with Redis commands and reduces learning costs.


Use Example 1. Add the following bean definitions to the spring configuration file

<bean id = "deerletRedisClient" class = "cn.zxl.deerlet.redis.client.spring.DeerletRedisClientFactoryBean">
  <property name = "connectionPool">
    <bean class = "cn.zxl.deerlet.redis.client.spring.ConnectionPoolFactoryBean">
      <property name = "initSize" value = "20"> </ property>
      <property name = "minIdleSize" value = "15"> </ property>
      <property name = "maxIdleSize" value = "30"> </ property>
      <property name = "maxSize" value = "100"> </ property>
    </ bean>
  </ property>
</ bean>
2. Add the following file in the classpath (such as under src in eclipse), named deletelet.properties
#The attribute is redis server ip
address = localhost
#The attribute is the redis server port
port = 6379
3. Use the following programmatic way to use the deleter
ApplicationContext applicationContext = new FileSystemXmlApplicationContext ("classpath: applicationContext.xml"); // Initialize the spring container
DeerletRedisClient deerletRedisClient = applicationContext.getBean (DeerletRedisClient.class); // Get client object

deerletRedisClient.set ("testKey", "testValue"); // Store a key-value pair whose key is testKey and value is testValue
System.out.println (deerletRedisClient.get ("testKey")); // Get
System.out.println (deerletRedisClient.dbSize ()); // View size
deerletRedisClient.flushAll (); // Refresh
System.out.println (deerletRedisClient.dbSize ()); // View size
 

recruit


The second purpose of this article is to recruit colleagues to maintain deerlet with LZ. After all, a person has limited energy. LZ needs everyone's strength to maintain it. I hope that interested ape friends can join together. If you want to contact LZ, you can also enter the LZ communication group (the group number is on the left side column of the page).



Vision


LZ has a small vision, I hope that one day, deerlet can have real real users, even one. At the very least, it is a product born under our efforts.

Come on!

       
Write your own redis client [deerlet-redis-client], share and recruit.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.