GithubHelp home page GithubHelp logo

analog-nico / two-buckets-memcache Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 0.0 335 KB

Memcache that trades a simplified expiry strategy for a super low resource consumption

License: ISC License

JavaScript 100.00%

two-buckets-memcache's People

Contributors

analog-nico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

two-buckets-memcache's Issues

Start timer for a bucket only after the first set() is called?

First of, thanks for sharing this great component!

I haven't look into your code yet, and is commenting based on your documentation, so you may be doing this already. It seems like we can optimize this a little further by only starting a timer for a bucket after the first set() is called upon it. I think the advantage is two folds:

  1. Cut down the overhead when some bucket is never used, and you end up busy replacing an empty bucket with another.
  2. Since the timer is only starting when the first item is put into it, you are essentially normalizing the expiration time for all items toward 20 seconds (per your example), so they are a little more consistent.

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.