惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
V
V2EX
IT之家
IT之家
J
Java Code Geeks
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
D
Docker
S
Secure Thoughts
Recent Announcements
Recent Announcements
Webroot Blog
Webroot Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
博客园_首页
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Security Archives - TechRepublic
Security Archives - TechRepublic
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
I
InfoQ
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
T
Troy Hunt's Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
美团技术团队
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Scott Helme
Scott Helme
T
Tor Project blog
Know Your Adversary
Know Your Adversary
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
G
Google Developers Blog

博客园 - hiaming

doclever 5.5.1 安装及升级【原创】 SPARROW-JS 从0开始写 0依赖,原生JS框架 Sparrow算法篇 从日期取交集到思维模式-2 高性能轻量级markdown 解析器java 版sparrow-markdown Sparrow 算法篇 由日期取交集到思维模式 自己动手写mvc框架SPARROW MVC SPARROW 框架redis客户端封装实践 SPARROW架构介绍 Sparrow 框架设计哲学 陌院俅颗难炎先当粮澜 openresty在centos/redhat6.7上部署 tomcat 日志那点事 Redhat6.7 切换Centos yum源 Quartz corn时间表达式(转) Jquery控制滚动Div 滚动条事件 fastjson排序 Map多层嵌套转换自动排序问题终极解决方案 Spring 外部注入Bean (JAX-WS) SSH,如何恢复通过输入密码的方式来登录服务器 Redhat Linux6.5 开启VNC 远程桌面
REDIS客户端封装实践2
hiaming · 2018-01-30 · via 博客园 - hiaming

接上一篇

[REDIS客户端封装意淫](https://www.jianshu.com/p/03132e0d50e2)

对现在有接口,进一步重构。

  1. 进一步对客户端友好封装,对数据类型的转换,封装进框架内。
  2. 增加CacheDataNotFound hook,并保留原有异常抛出接口,提供客户端灵活调用。
  3. 对key的business 部分提供灵活扩展接口,为特定业务的监控提供扩展。
  4. 接口不只依赖redis,理论上可以对redis 的不同接口进行实现,包括jedis sharded jedis jedisson以及其他异构缓存系统。
  5. 将接口按类型进行拆分,避免类过于宠大,不利于维护。
  6. 提供monitor接口 befare和montor 方法,客户端可根据需要进行扩展,如果需要对redis 限流,可实现before接口,如果不需要则直接返回true。
  7. 提供限流工具类。AbstractLock 客户端可以根本需要进行实现。
  8. 将redis 客户端从sparrow 分拆出来,单独部署,单独维护,单独版本控制。

实现类图如下


class-diagram.png

class-diagram.png

测试用例
https://github.com/sparrowzoo/sparrow-test

欢迎大家转载,也欢迎各位有兴趣的朋友一起加入.
由于个人能力有限,难免有些不足之处,警请谅解。谢谢!

GITHUB 地址

https://github.com/sparrowzoo/sparrow-sharded-jedis

posted on 2018-01-30 13:32  hiaming  阅读(176)  评论()    收藏  举报