zoukankan      html  css  js  c++  java
  • 自己编写redis客户端[deerlet-redis-client],分享与招募。

    引言

      

      最近工作上有需要使用redis,于是便心血来潮打算自己写一个Java客户端。经过两天的努力,目前该客户端已经基本成型。不过可惜的是,由于redis的命令众多,因此LZ还需要慢慢扩展它去支持更多的命令。

      

    分享

      

      本文只有两个目的,第一个是分享,既然是分享,自然是分享源码。LZ已经将源码放到了Github上去,各位可以去LZ的Github上取得源码,项目名称为deerlet-redis-client。

      接下来就是LZ“惊心”编写的一套项目介绍。请大家过目,如下所示。

    ---------------------我是分割线---------------------------

    deerlet-redis-client

    deerlet是一个简单易用的redis for java客户端,支持与spring无缝集成。

    特性

    1,轻量级,jar包只有25kb。
    2,简单易用,无侵入性。
    3,可以与当前流行的ioc容器spring无缝集成。
    4,API完全与redis命令保持一致,减少学习成本。

    使用示例

    1.在spring的配置文件中加入如下bean定义

    <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.在classpath(比如eclipse中src下)路径下添加以下文件,名为deerlet.properties

    #该属性为redis服务器ip
    address=localhost
    #该属性为redis服务器端口
    port=6379

    3.使用以下编程式的方式即可使用deerlet

    ApplicationContext applicationContext = new FileSystemXmlApplicationContext("classpath:applicationContext.xml");//初始化spring容器
    DeerletRedisClient deerletRedisClient = applicationContext.getBean(DeerletRedisClient.class);//获取client对象
    
    deerletRedisClient.set("testKey","testValue");//存储一个键为testKey,值为testValue的键值对
    System.out.println(deerletRedisClient.get("testKey"));//获取
    System.out.println(deerletRedisClient.dbSize());//查看大小
    deerletRedisClient.flushAll();//刷新
    System.out.println(deerletRedisClient.dbSize());//查看大小

    招募

      

      本文的第二个目的,就是招募同僚,来一起和LZ维护deerlet。一个人毕竟精力有限,LZ需要大家的力量一起来维护它,希望有兴趣的猿友一起加入,如果想联系LZ的话,也可以进LZ的交流群(群号在页面左边侧栏)。

      

    愿景

      

      LZ有一个小小的愿景,希望有一天,deerlet可以有真正真实的用户,哪怕是一个也好。最起码,它是在我们的努力下诞生的产品。

      加油吧!

     
     
     
     
  • 相关阅读:
    Spring Cloud Config 配置中心
    Spring Cloud Zuul 路由网关
    Spring Cloud Hystrix 断路器
    Spring Cloud feign 服务消费者
    Spring Cloud Ribbon 负载均衡
    Spring Cloud Eureka 服务注册与发现
    CSS编辑工具
    CSS简史
    CSS简介
    Less的内置函数
  • 原文地址:https://www.cnblogs.com/zuoxiaolong/p/github1.html
Copyright © 2011-2022 走看看