Git Product home page Git Product logo

Comments (4)

jaemk avatar jaemk commented on August 11, 2024

It's not currently possible, but I'd be happy to accept a PR if you can get to it before I have time to work on it. It would be pretty straightforward to add support to the TimedCache and TimedSizedCache to accept a subsecond_nanos so the pair of (seconds, subsec_nanos) can be compared against the pair that makes a Duration. Then there's several places in the impl of both cache types that need to be updated to include checking subsec nano (ex. here and here), and also adding a macro argument for it (around here)

from cached.

newcomb-luke avatar newcomb-luke commented on August 11, 2024

@jaemk
I am interested in implementing this and submitting a pull request. Although I have a few implementation concerns/questions. I'm guessing that changing the outward facing API in a breaking way would be a concern of yours.

What should be done about the following functions to allow subsecond TTL?

  • TimedCache::with_lifespan
  • TimedCache::with_lifespan_and_capacity
  • TimedCache::with_lifespan_and_refresh
  • Cached::cache_lifespan
  • Cached::cache_set_lifespan

New versions of all of these could be created with the ability to pass in a lifespan with additional subsecond_nanos, but the function names seem to get quite long and redundant. It also seems beneficial to switch the internal representation of the lifespan to a Duration.
It seems like it would be nice to just pass in a duration as the lifespan, but that would be a breaking API change.

from cached.

Related Issues (20)

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.