RxCache | Reactive caching library for Android and Java | Caching library
kandi X-RAY | RxCache Summary
kandi X-RAY | RxCache Summary
The goal of this library is simple: caching your data models like Picasso caches your images, with no effort at all. Every Android application is a client application, which means it does not make sense to create and maintain a database just for caching data. Plus, the fact that you have some sort of legendary database for persisting your data does not solves by itself the real challenge: to be able to configure your caching needs in a flexible and simple way. Inspired by Retrofit api, RxCache is a reactive caching library for Android and Java which turns your caching needs into an interface. When supplying an observable, single, maybe or flowable (these are the supported Reactive types) which contains the data provided by an expensive task -probably an http connection, RxCache determines if it is needed to subscribe to it or instead fetch the data previously cached. This decision is made based on the providers configuration.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Clones this map
- Changes the size of the data structure
- Put a key - value mapping into this map
- Adds a new key - value pair
- Invokes the method
- Gets observable
- Gets the object from an array parameter
- Retrieves a record from disk
- Decrypts a file
- Returns true if the map contains the specified key
- Start the migrations
- Initialize this class
- Retrieves an Array from the cache
- Retrieves a previously saved collection
- Retrieve a map
- Retrieves all the keys from all files in the cache directory
- Retrieves the migrations for the specified providers
- Returns the value mapped to the specified key
- Obtain the eviction task
- Returns a string representation of this Map
- Reads the map data from the given stream
- Generate a list of providers
- Compares this map with another map
- Retrieve memory in megabytes
- Retrieves the object from cache
- Write the map data to the 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
Finally, instantiate the Providers interface using RxCache.Builder and supplying a valid file system path which would allow RxCache to write on disk.
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