本文整理了Java中com.psddev.dari.db.Query.noCache
方法的一些代码示例,展示了Query.noCache
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.noCache
方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:noCache
[英]Sets this query to prevent being cached and returning a cached result.
[中]设置此查询以防止缓存并返回缓存结果。
代码示例来源:origin: perfectsense/dari
.where("_id = ?", keyId)
.using(database)
.noCache()
.master()
.first());
代码示例来源:origin: perfectsense/brightspot-cms
.sortAscending("triggerDate")
.master()
.noCache()
.resolveInvisible()
.iterable(0)) {
代码示例来源:origin: perfectsense/brightspot-cms
long stateCount = Query.fromQuery(query).where("cms.workflow.currentState = ?", workflowState.getName()).noCache().count();
代码示例来源:origin: perfectsense/brightspot-cms
/**
* @return May be {@code null}.
*/
public ToolUser get() {
if (user != null) {
long newLastUpdate = Query
.from(ToolUser.class)
.where("_id = ?", user.getId())
.noCache()
.lastUpdate()
.getTime();
if (lastUpdate == null) {
lastUpdate = newLastUpdate;
} else if (lastUpdate != newLastUpdate) {
user = Query
.from(ToolUser.class)
.where("_id = ?", user.getId())
.noCache()
.first();
}
}
return user;
}
}
代码示例来源:origin: perfectsense/brightspot-cms
private long getAvailableActionCount(boolean archive) {
if (getSelection() != null) {
return itemsQuery().noCache().selectAll().stream().filter(i -> isItemActionable(i, archive)).count();
} else if (getSearch() != null) {
return isSearchActionable(getSearch(), archive) ? getSearch().toQuery(getSite()).count() : 0;
}
return 0;
}
代码示例来源:origin: perfectsense/brightspot-cms
String qrUrl = page.cmsUrl("qrCode");
if (user.isTfaRequired() && !user.isTfaEnabled() && !request.getRequestURI().startsWith(tfaUrl) && !request.getRequestURI().startsWith(qrUrl)) {
user = Query.from(ToolUser.class).where("_id = ?", user.getId()).noCache().master().first();
if (user != null && user.isTfaRequired() && !user.isTfaEnabled()) {
tfaUrl = page.cmsUrl("toolUserTfa", RETURN_PATH_PARAMETER, JspUtils.getAbsolutePath(request, ""));
代码示例来源:origin: perfectsense/dari
/**
* Returns {@code true} if any instances of the types associated
* with the given {@code name} have been updated since the given
* {@code time}.
*/
public static boolean isUpdated(String name, long time) {
Tracker tracker = Query
.from(Tracker.class)
.where("_id = ?", createTrackerId(name))
.master()
.noCache()
.first();
return tracker != null && tracker.getLastUpdate() > time;
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Makes a raw path, like {@code siteId:directoryId/item},
* using the given {@code site} and {@code path}.
*/
private String makeRawPath(Site site, String path) {
Matcher pathMatcher = StringUtils.getMatcher(normalizePath(path), "^(/.*?)([^/]*)/?$");
pathMatcher.find();
path = pathMatcher.group(1);
Directory dir = Query
.from(Directory.class)
.where("path = ?", path)
.master()
.noCache()
.first();
if (dir == null) {
dir = new Directory();
dir.setPath(path);
dir.saveImmediately();
}
String rawPath = dir.getRawPath() + pathMatcher.group(2);
if (site != null) {
rawPath = site.getRawPath() + rawPath;
}
return rawPath;
}
代码示例来源:origin: perfectsense/dari
private void recalculateImmediateIndexedMethods(UUID id) {
Set<ObjectMethod> immediateMethods = new HashSet<ObjectMethod>();
for (ObjectMethod method : getRecalculableObjectMethods(db, typeId, fieldName)) {
RecalculationFieldData methodData = method.as(RecalculationFieldData.class);
if (methodData.isImmediate()) {
immediateMethods.add(method);
}
}
if (!immediateMethods.isEmpty()) {
Object obj = Query.fromAll().master().noCache().where("_id = ?", id).first();
State state = State.getInstance(obj);
if (state != null) {
Database stateDb = state.getDatabase();
stateDb.beginIsolatedWrites();
try {
for (ObjectMethod method : immediateMethods) {
method.recalculate(state);
}
stateDb.commitWrites();
} finally {
stateDb.endWrites();
}
}
}
}
代码示例来源:origin: perfectsense/dari
Query<?> query = Query.fromType(type).noCache().master();
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Recreates the originating object with the differences merged.
*
* @return {@code null} if the object type is {@code null}.
*/
@SuppressWarnings("deprecation")
public Object recreate() {
ObjectType type = getObjectType();
if (type == null) {
return null;
}
UUID id = getObjectId();
Object object = Query.fromAll()
.where("_id = ?", id)
.noCache()
.resolveInvisible()
.first();
if (object == null) {
object = type.createObject(id);
}
merge(object);
return object;
}
代码示例来源:origin: perfectsense/dari
/** Immediately refreshes all globals using the backing database. */
public synchronized void refreshGlobals() {
bootstrapOnce.ensure();
Database database = getDatabase();
LOGGER.info("Loading globals from [{}]", database.getName());
Query<Object> globalsQuery = Query
.from(Object.class)
.where("_id = ?", GLOBALS_ID)
.using(database)
.noCache();
State newGlobals = State.getInstance(globalsQuery.first());
if (newGlobals == null) {
newGlobals = State.getInstance(globalsQuery.master().first());
}
if (newGlobals == null) {
newGlobals = new State();
newGlobals.setDatabase(database);
newGlobals.setId(GLOBALS_ID);
newGlobals.save();
}
globals = newGlobals;
lastGlobalsUpdate = new Date();
fieldsCache.reset();
metricFieldsCache.reset();
indexesCache.reset();
}
代码示例来源:origin: perfectsense/brightspot-cms
.noCache()
.first());
代码示例来源:origin: perfectsense/dari
/**
* Returns the next number in the sequence with the given {@code name},
* or the given {@code initialValue} if the sequence has never been
* used before.
*
* @param name Can't be blank.
*/
public static long nextLong(String name, long initialValue) {
Sequence s = null;
while (true) {
s = Query.from(Sequence.class).where("name = ?", name).master().noCache().first();
if (s != null) {
break;
}
s = new Sequence();
s.setName(name);
s.setValue(initialValue);
try {
s.saveImmediately();
break;
} catch (ValidationException error) {
if (s.getState().getErrors(s.getState().getField("name")).isEmpty()) {
throw error;
}
}
}
return (long) s.next();
}
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Returns the lock associated with the given {@code aspect} of the
* given {@code content}.
*
* @param content Can't be {@code null}.
* @param aspect If {@code null}, it's equivalent to an empty string.
* @return May be {@code null} if there is no lock associated, or if
* the lock's owner is either archived or deleted.
*/
public static ContentLock findLock(Object content, String aspect) {
ContentLock lock = Query
.from(ContentLock.class)
.where("_id = ?", createLockId(content, aspect))
.master()
.noCache()
.first();
if (lock != null) {
Object owner = lock.getOwner();
// Owner is deleted.
if (owner == null) {
unlock(content, null, null);
return null;
// Owner is archived.
} else if (State.getInstance(owner).as(Content.ObjectModification.class).isTrash()) {
return null;
}
}
return lock;
}
代码示例来源:origin: perfectsense/brightspot-cms
public static History publishDifferences(
Object object,
Map<String, Map<String, Object>> differences,
Site site,
ToolUser user) {
State state = State.getInstance(object);
UUID id = state.getId();
DistributedLock lock = DistributedLock.Static.getInstance(
Database.Static.getDefault(),
Content.class.getName() + "/publish/" + id);
lock.lock();
try {
Object oldObject = Query.fromAll().where("_id = ?", id).noCache().first();
if (oldObject != null) {
state.setValues(Draft.mergeDifferences(
state.getDatabase().getEnvironment(),
State.getInstance(oldObject).getSimpleValues(),
differences));
}
return publish(object, site, user);
} finally {
lock.unlock();
}
}
代码示例来源:origin: perfectsense/brightspot-cms
.where("com.psddev.cms.db.Draft/schedule = ?", this)
.master()
.noCache()
.resolveInvisible()
.selectAll()) {
代码示例来源:origin: perfectsense/brightspot-cms
.where("_id = ?", lockId)
.master()
.noCache()
.first();
代码示例来源:origin: perfectsense/dari
app = query.clone().noCache().first();
if (app == null) {
app = (T) type.createObject(null);
代码示例来源:origin: perfectsense/brightspot-cms
.fromAll()
.where("_id = ?", state.getId())
.noCache()
.first());
内容来源于网络,如有侵权,请联系作者删除!