Git Product home page Git Product logo

jie_cache's Introduction

JieCache

本项目是在极客兔兔的分布式缓存 GeeCache 的基础上来编写的,这是原来的地址:7天用Go从零实现分布式缓存GeeCache

该缓存是一个只能查询,不能删除和更新的分布式缓存,只适用于一些特定的使用场景,比如你缓存一些静态文件,用文件 md5 作为 key,value 就是文件。这种场景就很适合用这种缓存,因为 key 对应的 value 不需要变。

原项目实现的功能

  • 支持 LRU 的内存淘汰策略
  • 使用 go 锁机制保证缓存的读写并发安全
  • 创建 HTTP 服务,来提供缓存的查询
  • 使用一致性哈希算法来选择分布式节点,实现负载均衡
  • 内部实现 singleflight 解决缓存击穿的问题
  • 使用 protobuf 优化节点间二进制通信

新增功能

  • 支持 LFU 的内存淘汰策略,用户可以方便进行配置
  • 支持热点数据缓存 hotCache,实现热数据多节点备份

缓存查询流程

使用一致性哈希选择节点        是                                    是  
    |-----> 是否是远程节点 -----> HTTP 客户端访问远程节点 --> 成功?-----> 服务端返回返回值  
                    |  否                                    ↓  否  
                    |----------------------------> 回退到本地节点处理。  

jie_cache's People

Contributors

kindleheart avatar

Watchers

 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.