- Focked from VictorAlbertos/RxCache
- Read doc from VictorAlbertos/RxCache
Diff from VictorAlbertos/RxCache
-
UseExpiredDataIfLoaderNotAvailable
-
Features:
- Enable feature descripted by
.useExpiredDataIfLoaderNotAvailable
- Use local overdue data if network has some error
- Enable feature descripted by
-
Deprecated( Removed )
RxCache.Builder().useExpiredDataIfLoaderNotAvailable -
Add annotation
@UseExpiredDataIfNotLoaderAvailable
-
Usage:
@UseExpiredDataIfNotLoaderAvailable @LifeCache(duration = 2, timeUnit = TimeUnit.HOURS) public Observable<Person> getPersion(Observable<Person> personSingle)
-
-
Interceptor
-
Deprecated encryption features
// @Encrypt // @EncryptKey
-
add Interceptor, you can realize encrypt by interceptor
-
Usage: to Demo
import io.rx_cache2.internal.interceptor.Interceptor; public class EncryptionInterceptor implements Interceptor { @Override public String onSave(String string) { return AESUtil.encrypt(string); } @Override public String onRetrieve(String string) { return AESUtil.decrypt(string); } }
private CommonCache getCommonCache() { return new RxCache.Builder() .addInterceptor(new EncryptionInterceptor()) .persistence(...) .using(CommonCache.class); }
@Interceptors(classes = EncryptionInterceptor.class) @LifeCache(duration = 10, timeUnit = TimeUnit.SECONDS) Single<CurTime> getCurTime(Single<CurTime> single);
-
you can do more with interceptor.
-