com.psddev.dari.db.Query.noCache()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中com.psddev.dari.db.Query.noCache方法的一些代码示例,展示了Query.noCache的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.noCache方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:noCache

Query.noCache介绍

[英]Sets this query to prevent being cached and returning a cached result.
[中]设置此查询以防止缓存并返回缓存结果。

代码示例

代码示例来源:origin: perfectsense/dari

  1. .where("_id = ?", keyId)
  2. .using(database)
  3. .noCache()
  4. .master()
  5. .first());

代码示例来源:origin: perfectsense/brightspot-cms

  1. .sortAscending("triggerDate")
  2. .master()
  3. .noCache()
  4. .resolveInvisible()
  5. .iterable(0)) {

代码示例来源:origin: perfectsense/brightspot-cms

  1. long stateCount = Query.fromQuery(query).where("cms.workflow.currentState = ?", workflowState.getName()).noCache().count();

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * @return May be {@code null}.
  3. */
  4. public ToolUser get() {
  5. if (user != null) {
  6. long newLastUpdate = Query
  7. .from(ToolUser.class)
  8. .where("_id = ?", user.getId())
  9. .noCache()
  10. .lastUpdate()
  11. .getTime();
  12. if (lastUpdate == null) {
  13. lastUpdate = newLastUpdate;
  14. } else if (lastUpdate != newLastUpdate) {
  15. user = Query
  16. .from(ToolUser.class)
  17. .where("_id = ?", user.getId())
  18. .noCache()
  19. .first();
  20. }
  21. }
  22. return user;
  23. }
  24. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. private long getAvailableActionCount(boolean archive) {
  2. if (getSelection() != null) {
  3. return itemsQuery().noCache().selectAll().stream().filter(i -> isItemActionable(i, archive)).count();
  4. } else if (getSearch() != null) {
  5. return isSearchActionable(getSearch(), archive) ? getSearch().toQuery(getSite()).count() : 0;
  6. }
  7. return 0;
  8. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. String qrUrl = page.cmsUrl("qrCode");
  2. if (user.isTfaRequired() && !user.isTfaEnabled() && !request.getRequestURI().startsWith(tfaUrl) && !request.getRequestURI().startsWith(qrUrl)) {
  3. user = Query.from(ToolUser.class).where("_id = ?", user.getId()).noCache().master().first();
  4. if (user != null && user.isTfaRequired() && !user.isTfaEnabled()) {
  5. tfaUrl = page.cmsUrl("toolUserTfa", RETURN_PATH_PARAMETER, JspUtils.getAbsolutePath(request, ""));

代码示例来源:origin: perfectsense/dari

  1. /**
  2. * Returns {@code true} if any instances of the types associated
  3. * with the given {@code name} have been updated since the given
  4. * {@code time}.
  5. */
  6. public static boolean isUpdated(String name, long time) {
  7. Tracker tracker = Query
  8. .from(Tracker.class)
  9. .where("_id = ?", createTrackerId(name))
  10. .master()
  11. .noCache()
  12. .first();
  13. return tracker != null && tracker.getLastUpdate() > time;
  14. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Makes a raw path, like {@code siteId:directoryId/item},
  3. * using the given {@code site} and {@code path}.
  4. */
  5. private String makeRawPath(Site site, String path) {
  6. Matcher pathMatcher = StringUtils.getMatcher(normalizePath(path), "^(/.*?)([^/]*)/?$");
  7. pathMatcher.find();
  8. path = pathMatcher.group(1);
  9. Directory dir = Query
  10. .from(Directory.class)
  11. .where("path = ?", path)
  12. .master()
  13. .noCache()
  14. .first();
  15. if (dir == null) {
  16. dir = new Directory();
  17. dir.setPath(path);
  18. dir.saveImmediately();
  19. }
  20. String rawPath = dir.getRawPath() + pathMatcher.group(2);
  21. if (site != null) {
  22. rawPath = site.getRawPath() + rawPath;
  23. }
  24. return rawPath;
  25. }

代码示例来源:origin: perfectsense/dari

  1. private void recalculateImmediateIndexedMethods(UUID id) {
  2. Set<ObjectMethod> immediateMethods = new HashSet<ObjectMethod>();
  3. for (ObjectMethod method : getRecalculableObjectMethods(db, typeId, fieldName)) {
  4. RecalculationFieldData methodData = method.as(RecalculationFieldData.class);
  5. if (methodData.isImmediate()) {
  6. immediateMethods.add(method);
  7. }
  8. }
  9. if (!immediateMethods.isEmpty()) {
  10. Object obj = Query.fromAll().master().noCache().where("_id = ?", id).first();
  11. State state = State.getInstance(obj);
  12. if (state != null) {
  13. Database stateDb = state.getDatabase();
  14. stateDb.beginIsolatedWrites();
  15. try {
  16. for (ObjectMethod method : immediateMethods) {
  17. method.recalculate(state);
  18. }
  19. stateDb.commitWrites();
  20. } finally {
  21. stateDb.endWrites();
  22. }
  23. }
  24. }
  25. }

代码示例来源:origin: perfectsense/dari

  1. Query<?> query = Query.fromType(type).noCache().master();

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Recreates the originating object with the differences merged.
  3. *
  4. * @return {@code null} if the object type is {@code null}.
  5. */
  6. @SuppressWarnings("deprecation")
  7. public Object recreate() {
  8. ObjectType type = getObjectType();
  9. if (type == null) {
  10. return null;
  11. }
  12. UUID id = getObjectId();
  13. Object object = Query.fromAll()
  14. .where("_id = ?", id)
  15. .noCache()
  16. .resolveInvisible()
  17. .first();
  18. if (object == null) {
  19. object = type.createObject(id);
  20. }
  21. merge(object);
  22. return object;
  23. }

代码示例来源:origin: perfectsense/dari

  1. /** Immediately refreshes all globals using the backing database. */
  2. public synchronized void refreshGlobals() {
  3. bootstrapOnce.ensure();
  4. Database database = getDatabase();
  5. LOGGER.info("Loading globals from [{}]", database.getName());
  6. Query<Object> globalsQuery = Query
  7. .from(Object.class)
  8. .where("_id = ?", GLOBALS_ID)
  9. .using(database)
  10. .noCache();
  11. State newGlobals = State.getInstance(globalsQuery.first());
  12. if (newGlobals == null) {
  13. newGlobals = State.getInstance(globalsQuery.master().first());
  14. }
  15. if (newGlobals == null) {
  16. newGlobals = new State();
  17. newGlobals.setDatabase(database);
  18. newGlobals.setId(GLOBALS_ID);
  19. newGlobals.save();
  20. }
  21. globals = newGlobals;
  22. lastGlobalsUpdate = new Date();
  23. fieldsCache.reset();
  24. metricFieldsCache.reset();
  25. indexesCache.reset();
  26. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. .noCache()
  2. .first());

代码示例来源:origin: perfectsense/dari

  1. /**
  2. * Returns the next number in the sequence with the given {@code name},
  3. * or the given {@code initialValue} if the sequence has never been
  4. * used before.
  5. *
  6. * @param name Can't be blank.
  7. */
  8. public static long nextLong(String name, long initialValue) {
  9. Sequence s = null;
  10. while (true) {
  11. s = Query.from(Sequence.class).where("name = ?", name).master().noCache().first();
  12. if (s != null) {
  13. break;
  14. }
  15. s = new Sequence();
  16. s.setName(name);
  17. s.setValue(initialValue);
  18. try {
  19. s.saveImmediately();
  20. break;
  21. } catch (ValidationException error) {
  22. if (s.getState().getErrors(s.getState().getField("name")).isEmpty()) {
  23. throw error;
  24. }
  25. }
  26. }
  27. return (long) s.next();
  28. }
  29. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Returns the lock associated with the given {@code aspect} of the
  3. * given {@code content}.
  4. *
  5. * @param content Can't be {@code null}.
  6. * @param aspect If {@code null}, it's equivalent to an empty string.
  7. * @return May be {@code null} if there is no lock associated, or if
  8. * the lock's owner is either archived or deleted.
  9. */
  10. public static ContentLock findLock(Object content, String aspect) {
  11. ContentLock lock = Query
  12. .from(ContentLock.class)
  13. .where("_id = ?", createLockId(content, aspect))
  14. .master()
  15. .noCache()
  16. .first();
  17. if (lock != null) {
  18. Object owner = lock.getOwner();
  19. // Owner is deleted.
  20. if (owner == null) {
  21. unlock(content, null, null);
  22. return null;
  23. // Owner is archived.
  24. } else if (State.getInstance(owner).as(Content.ObjectModification.class).isTrash()) {
  25. return null;
  26. }
  27. }
  28. return lock;
  29. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. public static History publishDifferences(
  2. Object object,
  3. Map<String, Map<String, Object>> differences,
  4. Site site,
  5. ToolUser user) {
  6. State state = State.getInstance(object);
  7. UUID id = state.getId();
  8. DistributedLock lock = DistributedLock.Static.getInstance(
  9. Database.Static.getDefault(),
  10. Content.class.getName() + "/publish/" + id);
  11. lock.lock();
  12. try {
  13. Object oldObject = Query.fromAll().where("_id = ?", id).noCache().first();
  14. if (oldObject != null) {
  15. state.setValues(Draft.mergeDifferences(
  16. state.getDatabase().getEnvironment(),
  17. State.getInstance(oldObject).getSimpleValues(),
  18. differences));
  19. }
  20. return publish(object, site, user);
  21. } finally {
  22. lock.unlock();
  23. }
  24. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. .where("com.psddev.cms.db.Draft/schedule = ?", this)
  2. .master()
  3. .noCache()
  4. .resolveInvisible()
  5. .selectAll()) {

代码示例来源:origin: perfectsense/brightspot-cms

  1. .where("_id = ?", lockId)
  2. .master()
  3. .noCache()
  4. .first();

代码示例来源:origin: perfectsense/dari

  1. app = query.clone().noCache().first();
  2. if (app == null) {
  3. app = (T) type.createObject(null);

代码示例来源:origin: perfectsense/brightspot-cms

  1. .fromAll()
  2. .where("_id = ?", state.getId())
  3. .noCache()
  4. .first());

相关文章