Comments (3)
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.
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.
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)
- duplicate entry: com/squareup/otto/AnnotatedHandlerFinder.class HOT 1
- NoClassDefFoundError when running in Android OS below 5.0. HOT 3
- subcriber received two same event HOT 2
- Please include the deprecated notice in the info website
- Examples HOT 1
- Please add notice to website about otto deprication HOT 1
- How to customize ThreadEnforcer HOT 4
- Using privitives in callback haven't invoked it. HOT 3
- Link for Migrating to RxJava is dead. HOT 1
- Private EventHandler makes it impossible to override Bus#dispatch HOT 1
- OnEvent not calling in navigationdrawer fragment
- otto with JavascriptInterface in api < 17 HOT 1
- Ship proguard rules in the aar? HOT 1
- A new call to post in a subscriber does not call its subscribers until the first call is completed HOT 1
- Reason for its name HOT 1
- android.database.sqlite.SQLiteException: no such table HOT 4
- Update for Gradle 4 and Bus doesnt work more. HOT 3
- I can't receive the event HOT 1
- java.lang.RuntimeException: Could not dispatch event: class abc to handler
- java.lang.RuntimeException: Could not dispatch event HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otto.