RxCache | 简单一步,缓存搞定。这是一个专用于 RxJava,解决 Android 中对任何 Observable | Reactive Programming library
kandi X-RAY | RxCache Summary
kandi X-RAY | RxCache Summary
简单一步,缓存搞定。这是一个专用于 RxJava,解决 Android 中对任何 Observable 发出的结果做缓存处理的框架。.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Load a single cacheable from the cache
- Load a flowable flowable into the cache
- Loads the result into the cache
- Save value to flowable
- Executes the cache
- Loads the specified key from disk
- Gets the MD5 message digest
- Save the cache
- Compute the size of a given value
- Obtain total number of objects in the given object
- Returns the size of the object
- Loads the cache
- Writes the object to the given stream
- Loads a cacheable from the cache
- Loads a value from the input stream
- Loads the result from the cache
- Writes the given object to the given stream
- Load the cache
- Loops through the cache and returns the result
- Clear cache
- Loads a JSON document from the given input stream
RxCache Key Features
RxCache Examples and Code Snippets
Community Discussions
Trending Discussions on RxCache
QUESTION
I'm using RxCache on my Android project and I have a problem when the user has no internet connection.
Is there a way to prevent an observable from getting evicted if no data is returned from the server?
For example, each time the user refreshes a news feed (pull to refresh) getRepository().getFeedPosts(tag, new EvictProvider(true));
gets called.
If the user suddently loses his connection to the internet and refreshes the feed again, no data gets returned from the server, the observable gets evicted and it returns the cached version (since I'm setting useExpiredDataIfLoaderNotAvailable(true)
on the RxCache builder).
Again with no internet connection, if the user refreshes a second time, no cached data is available.
Is there a way to prevent that from happening?
Thanks
...ANSWER
Answered 2017-May-26 at 16:09Answering my own question, I guess it's a RxCache limitation.
This is what Victor Albertos from RxCache told me:
I don't think that's possible. Precisely, this is the way you evict the data of some provider, by creating an observable that just throws. I admit this is not optimal, but if you want to use a more mature API which handles these scenarios properly, I recommend to you to use ReactiveCache
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install RxCache
You can use RxCache like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the RxCache component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page