Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public class MyService extends OkHttpSpiceService {
  2.  
  3. @Override
  4. public CacheManager createCacheManager(Application application) throws CacheCreationException {
  5. CacheManager cacheManager = new CacheManager();
  6. int cacheSize = 1 * 1024 * 1024; // 1MiB
  7. cacheManager.addPersister(new LruCacheObjectPersister<LoginModel>(LoginModel.class,
  8. new LruCache<Object, CacheItem<LoginModel>>(cacheSize)));
  9. return cacheManager;
  10. }
  11.  
  12. }
  13.  
  14. @Override
  15. public void onStart() {
  16. super.onStart();
  17. //spice manager gets started in base fragment
  18. spiceManager.addListenerIfPending(LoginModel.class, REQUEST_KEY, new LoginRequestListener());
  19. }
  20.  
  21. spiceManager.execute(new LoginRequest(), REQUEST_KEY, DurationInMillis.ONE_DAY,
  22. new LoginRequestListener());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement