Comments (5)
是这样没错,你用2.0版的话。因为RxJava2.0不能发出null值,你的以上2种情况使用的是 Observable.empty()
。
如需定制,你可以继承BaseStrategy
或者去实现IStrategy
。
另外RxCache还有save
和load
方法,返回的是Observable
,你可以不使用compose(rxCache.<~>transformer...))
方式,自由组合成你想要的策略
from rxcache.
明白,看来是需要定制了。需求缓存策略是:先加载缓存数据到页面,再网络数据。用户第一次进入时,没网络,没缓存,再看网络请求是否成功。onError最终就要onError。当缓存有数据时,即使网络出现onError, 页面数据也还是应该显示缓存数据,顶多用toast提醒用户"网络错误",这个看起来有些麻烦啊
from rxcache.
这确实是个问题,如果缓存没取到,网络onError了,最终就应该是要onError,而不是直Observable.empty(),不过你的这个需求在CacheAndRemotoStrategy的基础上修改很容易实现,我打算下个版本把这个问题解决。
from rxcache.
目前这样自己写一个就可以了,后面再参照你更好的做法。再一次感谢你的这个lib.
from rxcache.
已更新,已修复,使用v2.0.5版即可
from rxcache.
Related Issues (20)
- 在使用磁盘缓存时,在remove或者clean时,会出现空指针,程序未做非空判断。
- RxCache 几种模式在移动端场景。
- 建议,缓存策略,添加只缓存内存,或者只保存硬盘的。
- 建议添加到公共jcenter仓库 HOT 2
- 添加2.x版本,Fragment就找不到getContext() HOT 2
- LruDiskCache出现问题 HOT 3
- 优先缓存,并设置超时时间 这条没懂。。
- 关于分页缓存的管理
- 建议添加获取所有缓存key的方法。这样更有利于对于缓存的管理
- 报这个是什么错误额? HOT 2
- cacheAndRemote使用问题 HOT 3
- Expected BEGIN_OBJECT but was STRING at line 1 column 78 path $.data.version HOT 1
- 此项目还维护吗 HOT 1
- 不支持返回Single 吗?。。
- 可以支持优先加载缓存,并且同时缓存最新的网络数据 HOT 1
- 缓存第二次获取不到
- Jcenter 仓库地址已失效 HOT 1
- 2.3.3的库引用失败 HOT 1
- could not resolve HOT 1
- 支持post缓存吗?
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 rxcache.