Giter Club home page Giter Club logo

expireslidingwindow's Introduction

ExpireSlidingWindow (元素会过期的"滑动窗口")

适用用采用"窗口机制"控制消息处理速度的场景,窗口机制的优势是能自动调节生产者与消费者处理能力。使用时,处理消息前将消息put到窗口,消息被成功(或失败)处理后从窗口移除。

注意:窗口大小为初始化后的固定值不会变化,当窗口达到临界值时,不支持相同Key的元素更新。

功能点:

  1. 支持设定一个过期时间,元素在超过一定时长后,会自动从窗口清除,采用DelayQueue实现;
  2. 清除过期元素支持自定义回调函数来做清除后处理工作,比如更新数据库状态;
  3. 当窗口达到临界值大小时,不接受新的元素,且会触发自定义回调操作,可用于消息处理的担保机制。

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.