Giter VIP home page Giter VIP logo

Comments (3)

medikoo avatar medikoo commented on August 21, 2024

@rektide Do you really need that? What is the specific use case?

I'm not sure is it wise to provide it, also it may appear it'll bad for performance when used

e.g. if we would want to change maxAge on already setup memoized function, then for each already saved results we need to know how much time passed since they were cached (this information is not stored now), and either we need to clear them or replace their timeouts with new ones (that can be heavy for large number of items).

So this functionality may contradict idea of memoization, which is about saving resources, not sure if it's really worth it

from memoizee.

rektide avatar rektide commented on August 21, 2024

I have two cases I'm working with needing variable lifetimes- a data connection pool with near/far connections needing different lifecycles, and an implementation of etcd, which allows objects posted to be tagged with a TTL.

It'd be fine to not update retroactively. That's certainly something that can be done at a higher level easily, once there's some kind of finer granularity in memoize.

from memoizee.

medikoo avatar medikoo commented on August 21, 2024

a data connection pool with near/far connections needing different lifecycles

Wouldn't it be better for each lifecycle to have different memoized function configured?

and an implementation of etcd, which allows objects posted to be tagged with a TTL

That seems make sense. It may work as following:

// Timeout needs to be configured before function is invoked
memoizedFn.configureTimeout(timeout, ...args);
// Invoke function
memoizedFn(...args); // preset timeout is taken into account

It'd be fine to not update retroactively.

Yes, I guess if we'll implement it, it'll be strictly for future hits, no ongoing timeouts would be affected.

from memoizee.

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.