Java Code Examples for com.avos.avoscloud.AVQuery#setCachePolicy()
The following examples show how to use
com.avos.avoscloud.AVQuery#setCachePolicy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheService.java From LoveTalkClient with Apache License 2.0 | 5 votes |
public static List<AVUser> findUsers(List<String> userIds) throws AVException { if (userIds.size() <= 0) { return Collections.EMPTY_LIST; } AVQuery<AVUser> q = AVUser.getQuery(); q.whereContainedIn("objectId", userIds); q.setLimit(1000); q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE); return q.find(); }
Example 2
Source File: AddRequestService.java From LoveTalkClient with Apache License 2.0 | 5 votes |
public static int countAddRequests() throws AVException { AVQuery<AddRequest> q = AVObject.getQuery(AddRequest.class); q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE); q.whereEqualTo(AddRequest.TO_USER, AVUser.getCurrentUser()); try { return q.count(); } catch (AVException e) { if (e.getCode() == AVException.CACHE_MISS) { return 0; } else { throw e; } } }
Example 3
Source File: AddRequestService.java From LoveTalkClient with Apache License 2.0 | 5 votes |
public static List<AddRequest> findAddRequests() throws AVException { AVUser user = AVUser.getCurrentUser(); AVQuery<AddRequest> q = AVObject.getQuery(AddRequest.class); q.include(AddRequest.FROM_USER); q.whereEqualTo(AddRequest.TO_USER, user); q.orderByDescending("createdAt"); q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE); return q.find(); }
Example 4
Source File: AddFriendActivity.java From LoveTalkClient with Apache License 2.0 | 5 votes |
public void searchUser(String searchName, int skip, FindCallback<AVUser> findCallback) { AVQuery<AVUser> q = AVUser.getQuery(AVUser.class); q.whereContains("username", searchName); q.limit(10); q.skip(skip); AVUser user = AVUser.getCurrentUser(); List<String> friendIds = getFriendIds(); friendIds.add(user.getObjectId()); q.whereNotContainedIn("objectId", friendIds); q.orderByDescending("updateAt"); q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE); q.findInBackground(findCallback); }