Tabnine Logo
AVQuery.setCachePolicy
Code IndexAdd Tabnine to your IDE (free)

How to use
setCachePolicy
method
in
com.avos.avoscloud.AVQuery

Best Java code snippets using com.avos.avoscloud.AVQuery.setCachePolicy (Showing top 9 results out of 315)

origin: BaaSBeginner/leanchat-android

 public void findFriendsWithCachePolicy(AVQuery.CachePolicy cachePolicy, FindCallback<LeanchatUser>
   findCallback) {
  AVQuery<LeanchatUser> q = null;
  try {
   q = followeeQuery(LeanchatUser.class);
  } catch (Exception e) {
  }
  q.setCachePolicy(cachePolicy);
  q.setMaxCacheAge(TimeUnit.MINUTES.toMillis(1));
  q.findInBackground(findCallback);
 }
}
origin: WuXiaolong/WoChat

  public void findFriendsWithCachePolicy(AVQuery.CachePolicy cachePolicy, FindCallback<LeanchatUser>
      findCallback) {
    AVQuery<LeanchatUser> q = null;
    try {
      q = followeeQuery(LeanchatUser.class);
    } catch (Exception e) {
    }
    q.setCachePolicy(cachePolicy);
    q.setMaxCacheAge(TimeUnit.MINUTES.toMillis(1));
    q.findInBackground(findCallback);
  }
}
origin: BaaSBeginner/leanchat-android

private UpdateInfo getNewestUpdateInfo() throws AVException {
 AVQuery<UpdateInfo> query = AVObject.getQuery(UpdateInfo.class);
 query.setLimit(1);
 query.orderByDescending(UpdateInfo.VERSION);
 if (policy != null) {
  query.setCachePolicy(policy);
 }
 List<UpdateInfo> updateInfos = query.find();
 if (updateInfos.size() > 0) {
  return updateInfos.get(0);
 }
 return null;
}
origin: BaaSBeginner/leanchat-android

q.whereContainedIn(Constants.OBJECT_ID, uncachedIds);
q.setLimit(1000);
q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
q.findInBackground(new FindCallback<LeanchatUser>() {
 @Override
origin: WuXiaolong/WoChat

q.whereContainedIn(AppConstant.OBJECT_ID, uncachedIds);
q.setLimit(1000);
q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
q.findInBackground(new FindCallback<LeanchatUser>() {
 @Override
origin: BaaSBeginner/leanchat-android

/**
 * 从 server 获取未读消息的数量
 */
public void countUnreadRequests(final CountCallback countCallback) {
 AVQuery<AddRequest> addRequestAVQuery = AVObject.getQuery(AddRequest.class);
 addRequestAVQuery.setCachePolicy(AVQuery.CachePolicy.NETWORK_ONLY);
 addRequestAVQuery.whereEqualTo(AddRequest.TO_USER, LeanchatUser.getCurrentUser());
 addRequestAVQuery.whereEqualTo(AddRequest.IS_READ, false);
 addRequestAVQuery.countInBackground(new CountCallback() {
  @Override
  public void done(int i, AVException e) {
   if (null != countCallback) {
    unreadAddRequestsCount = i;
    countCallback.done(i, e);
   }
  }
 });
}
origin: BaaSBeginner/leanchat-android

private void loadMoreFriend(int skip, final int limit, final boolean isRefresh) {
 AVQuery<LeanchatUser> q = LeanchatUser.getQuery(LeanchatUser.class);
 q.whereContains(LeanchatUser.USERNAME, searchName);
 q.limit(Constants.PAGE_SIZE);
 q.skip(skip);
 LeanchatUser user = LeanchatUser.getCurrentUser();
 List<String> friendIds = new ArrayList<String>(FriendsManager.getFriendIds());
 friendIds.add(user.getObjectId());
 q.whereNotContainedIn(Constants.OBJECT_ID, friendIds);
 q.orderByDescending(Constants.UPDATED_AT);
 q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
 q.findInBackground(new FindCallback<LeanchatUser>() {
  @Override
  public void done(List<LeanchatUser> list, AVException e) {
   UserCacheUtils.cacheUsers(list);
   recyclerView.setLoadComplete(null == list ? null : list.toArray(), false);
   if (null != e) {
    showToast(e.getMessage());
   }
  }
 });
}
origin: BaaSBeginner/leanchat-android

public void findAddRequests(int skip, int limit, FindCallback findCallback) {
 LeanchatUser user = LeanchatUser.getCurrentUser();
 AVQuery<AddRequest> q = AVObject.getQuery(AddRequest.class);
 q.include(AddRequest.FROM_USER);
 q.skip(skip);
 q.limit(limit);
 q.whereEqualTo(AddRequest.TO_USER, user);
 q.orderByDescending(AVObject.CREATED_AT);
 q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
 q.findInBackground(findCallback);
}
origin: BaaSBeginner/leanchat-android

q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
q.findInBackground(new FindCallback<LeanchatUser>() {
 @Override
com.avos.avoscloudAVQuerysetCachePolicy

Javadoc

Change the caching policy of this query.

Popular methods of AVQuery

  • whereEqualTo
    Add a constraint to the query that requires a particular key's value to be equal to the provided val
  • <init>
  • findInBackground
    Retrieves a list of AVObjects that satisfy this query from the server in a background thread. This i
  • setLimit
    Controls the maximum number of results that are returned. Setting a negative limit denotes retrieval
  • assembleParameters
  • getClassName
    Accessor for the class name.
  • countInBackground
  • doCloudQueryInBackground
    通过cql查询对象
  • find
    Retrieves a list of AVObjects that satisfy this query. Uses the network and/or the cache, depending
  • whereNotContainedIn
    Add a constraint to the query that requires a particular key's value not be contained in the provide
  • addAndItems
  • addOrItems
  • addAndItems,
  • addOrItems,
  • addWhereItem,
  • doCloudQuery,
  • generateQueryPath,
  • get,
  • getFirstInBackground,
  • getInBackground,
  • getInclude,
  • getLimit

Popular in Java

  • Updating database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • startActivity (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now