Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyService extends OkHttpSpiceService {
- @Override
- public CacheManager createCacheManager(Application application) throws CacheCreationException {
- CacheManager cacheManager = new CacheManager();
- int cacheSize = 1 * 1024 * 1024; // 1MiB
- cacheManager.addPersister(new LruCacheObjectPersister<LoginModel>(LoginModel.class,
- new LruCache<Object, CacheItem<LoginModel>>(cacheSize)));
- return cacheManager;
- }
- }
- @Override
- public void onStart() {
- super.onStart();
- //spice manager gets started in base fragment
- spiceManager.addListenerIfPending(LoginModel.class, REQUEST_KEY, new LoginRequestListener());
- }
- spiceManager.execute(new LoginRequest(), REQUEST_KEY, DurationInMillis.ONE_DAY,
- new LoginRequestListener());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement