当前位置: 首页>>代码示例>>Java>>正文


Java CommonCache类代码示例

本文整理汇总了Java中me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache的典型用法代码示例。如果您正苦于以下问题:Java CommonCache类的具体用法?Java CommonCache怎么用?Java CommonCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommonCache类属于me.jessyan.mvparms.demo.mvp.model.api.cache包,在下文中一共展示了CommonCache类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUsers

import me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache; //导入依赖的package包/类
@Override
public Observable<List<User>> getUsers(int lastIdQueried, boolean update) {
    //使用rxcache缓存,上拉刷新则不读取缓存,加载更多读取缓存
    return Observable.just(mRepositoryManager
            .obtainRetrofitService(UserService.class)
            .getUsers(lastIdQueried, USERS_PER_PAGE))
            .flatMap(new Function<Observable<List<User>>, ObservableSource<List<User>>>() {
                @Override
                public ObservableSource<List<User>> apply(@NonNull Observable<List<User>> listObservable) throws Exception {
                    return mRepositoryManager.obtainCacheService(CommonCache.class)
                            .getUsers(listObservable
                                    , new DynamicKey(lastIdQueried)
                                    , new EvictDynamicKey(update))
                            .map(listReply -> listReply.getData());
                }
            });

}
 
开发者ID:Superingxz,项目名称:MoligyMvpArms,代码行数:19,代码来源:UserModel.java

示例2: getUsers

import me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache; //导入依赖的package包/类
@Override
public Observable<List<User>> getUsers(int lastIdQueried, boolean update) {
    Observable<List<User>> users = mRepositoryManager.obtainRetrofitService(UserService.class)
            .getUsers(lastIdQueried, USERS_PER_PAGE);
    //使用rxcache缓存,上拉刷新则不读取缓存,加载更多读取缓存
    return mRepositoryManager.obtainCacheService(CommonCache.class)
            .getUsers(users
                    , new DynamicKey(lastIdQueried)
                    , new EvictDynamicKey(update))
            .flatMap(new Function<Reply<List<User>>, ObservableSource<List<User>>>() {
                @Override
                public ObservableSource<List<User>> apply(@NonNull Reply<List<User>> listReply) throws Exception {
                    return Observable.just(listReply.getData());
                }
            });
}
 
开发者ID:hshare,项目名称:MVPArmsTest1,代码行数:17,代码来源:UserModel.java

示例3: getListData

import me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache; //导入依赖的package包/类
@Override
public Observable<NewsListEntity> getListData(String url,String cacheName, int page, int id, boolean update) {
  Observable<NewsListEntity> imageList = mRepositoryManager.obtainRetrofitService(CommonService.class)
      .getNewsList(page, id);
  //使用rxcache缓存,上拉刷新则不读取缓存,加载更多读取缓存
  return mRepositoryManager.obtainCacheService(CommonCache.class)
      .getNewsList(imageList
          , new DynamicKey(cacheName + page)
          , new EvictDynamicKey(update))
      .flatMap(new Function<Reply<NewsListEntity>, ObservableSource<NewsListEntity>>() {
        @Override
        public ObservableSource<NewsListEntity> apply(@NonNull Reply<NewsListEntity> stringReply) throws Exception {
          return Observable.just(stringReply.getData());
        }
      });
}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:17,代码来源:NewsListModel.java

示例4: getListData

import me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache; //导入依赖的package包/类
@Override
public Observable<ImageEntity> getListData(String url,String cacheName, int page, int id, boolean update) {
  Observable<ImageEntity> imageList = mRepositoryManager.obtainRetrofitService(CommonService.class)
      .getImageList(page, id);
  //使用rxcache缓存,上拉刷新则不读取缓存,加载更多读取缓存
  return mRepositoryManager.obtainCacheService(CommonCache.class)
      .getImageList(imageList
          , new DynamicKey(cacheName + page)
          , new EvictDynamicKey(update))
      .flatMap(new Function<Reply<ImageEntity>, ObservableSource<ImageEntity>>() {
        @Override
        public ObservableSource<ImageEntity> apply(@NonNull Reply<ImageEntity> stringReply) throws Exception {
          return Observable.just(stringReply.getData());
        }
      });
}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:17,代码来源:ImageListModel.java

示例5: provideCommonService

import me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache; //导入依赖的package包/类
@Singleton
@Provides
CommonCache provideCommonService(RxCache rxCache) {
    return rxCache.using(CommonCache.class);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:CacheModule.java

示例6: registerComponents

import me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache; //导入依赖的package包/类
@Override
public void registerComponents(Context context, IRepositoryManager repositoryManager) {
    repositoryManager.injectRetrofitService(CommonService.class, UserService.class);
    repositoryManager.injectRetrofitService(CommonService.class, HotsService.class);
    repositoryManager.injectCacheService(CommonCache.class);
}
 
开发者ID:hshare,项目名称:MVPArmsTest1,代码行数:7,代码来源:GlobalConfiguration.java

示例7: registerComponents

import me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache; //导入依赖的package包/类
@Override
public void registerComponents(Context context, IRepositoryManager repositoryManager) {
    repositoryManager.injectRetrofitService(CommonService.class);
    repositoryManager.injectCacheService(CommonCache.class);
}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:6,代码来源:GlobalConfiguration.java


注:本文中的me.jessyan.mvparms.demo.mvp.model.api.cache.CommonCache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。