Coder Social home page Coder Social logo

Cached events. about otto HOT 3 CLOSED

square avatar square commented on June 10, 2024
Cached events.

from otto.

Comments (3)

JakeWharton avatar JakeWharton commented on June 10, 2024

Moving this responsibility to the developer was a design decision.

Event caching inside of a bus is a bad idea because it's a great way to
accidentally leak references. With the current system it's perfectly fine
to post events with references to Views, Contexts, Application instances,
etc. because they're distributed but not retained.

Furthermore, an advantage of a producer is that you can update the produced
value as frequently as you want without having to post an event. Or you can
use the fact that a producer is only called when something new is
registered to trigger other events or actions (such as checking freshness
of data and kicking off a background refresh of data).
On Oct 18, 2013 3:32 AM, "Anup Cowkur" [email protected] wrote:

Can we have an option to cache events? The last event can be cached and
the next time a subscriber registers itself, it will receive a copy of that
cached event. We have the concept of producers but the developer has to
maintain his own cache and provide it to the producer. It would be
fantastic if there were an option to automate this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/97
.

from otto.

anupcowkur avatar anupcowkur commented on June 10, 2024

That makes a lot of sense. Maybe you guys can make it an advanced option like ThreadEnforcer.ANY for those who need it. Just a feature request. Thanks for taking the time to reply!

from otto.

imminent avatar imminent commented on June 10, 2024

It already has Producer though, don't want to have 2 similar features in a library, makes things complicated for users of the library. Which do I use? What's the difference? Etc. It's not that events can't be cached already, it's that the event bus WON'T maintain said cache. So, unlike ThreadEnforcer.ANY (which removes the feature of checking the Thread that an event was posted on) Otto already handles both cases of cached events and non-cached events without any configuration.

from otto.

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.