RxCache | Reactive caching library for Swift | Caching library
kandi X-RAY | RxCache Summary
kandi X-RAY | RxCache Summary
[Build Status] # RxCache. The goal of this library is simple: caching your data models like [SDWebImage] caches your images, with no effort at all. Every Swift 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 [Moya] api, RxCache is a reactive caching library for Swift which relies on [RxSwift] for turning your caching needs into an enum. Every enum value acts as a provider for RxCache, and all of them are managed through observables; they are the fundamental contract between the library and its clients. When supplying an observable which contains the data provided by an expensive task -probably a 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. So, when supplying an observable you get your observable cached back, and next time you will retrieve it without the time cost associated with its underlying task.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of RxCache
RxCache Key Features
RxCache Examples and Code Snippets
enum CacheProviders : Provider {
// Mock List
case getMocks() // Mock List without evicting
case getMocksEvictProvider(evictProvider : EvictProvider) // Mock List evicting
// Mock List Filtering
case getMocksFiltered(filter: Stri
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
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