net.sf.ehcache.search.Query.execute()方法的使用及代码示例

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

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

Query.execute介绍

[英]Execute this query. Every call to this method will re-execute the query and return a distinct results object.

An empty results object will be returned (on timeout) for non-stop enabled caches with net.sf.ehcache.config.TimeoutBehaviorConfiguration.TimeoutBehaviorType#NOOP and net.sf.ehcache.config.TimeoutBehaviorConfiguration.TimeoutBehaviorType#LOCAL_READS behavior
[中]执行这个查询。对该方法的每次调用都将重新执行查询并返回一个不同的results对象。
对于使用net的不间断启用缓存,将返回一个空的结果对象(超时)。旧金山。ehcache。配置。超时行为配置。TimeOutBehavior类型#NOOP和net。旧金山。ehcache。配置。超时行为配置。TimeoutBehaviorType#LOCAL_读取行为

代码示例

代码示例来源:origin: net.sf.ehcache/ehcache

Results search(Ehcache cache, String statement) throws SearchException {
  return createQuery(cache, statement).end().execute();
}

代码示例来源:origin: net.sf.ehcache/ehcache

Results results = q.execute();
List<Result> all = results.all();
List<Object[]> result = new ArrayList<Object[]>(results.size());

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

Results search(Ehcache cache, String statement) throws SearchException {
  return createQuery(cache, statement).end().execute();
}

代码示例来源:origin: org.pageseeder.bridge/pso-bridge

/**
 * Retrieve the object in the cache for the specified key.
 *
 * @param id The ID of the PageSeeder entity in the PageSeeder database.
 *
 * @return The version of the element or <code>null</code> if the key or element is <code>null</code>
 */
@Override
@SuppressWarnings("unchecked")
public synchronized @Nullable E get(Long id) {
 if (id == null)
  return null;
 @Nullable E o = null;
 Query query =  this._cache.createQuery();
 Attribute<Long> byId = this._cache.getSearchAttribute("id");
 query.includeValues().addCriteria(byId.eq(id));
 Results results = query.execute();
 List<Result> all = results.all();
 if (all.size() > 0) {
  Result r = all.get(0);
  o = (E)r.getValue();
 }
 return o;
}

代码示例来源:origin: org.pageseeder.bridge/pso-bridge

/**
 * Retrieve the object in the cache for the specified key.
 *
 * @param attribute The name of the attribute to match.
 * @param value       The value of the attribute to match.
 *
 * @return The list of matching element or <code>null</code> if the key or element is <code>null</code>
 */
@SuppressWarnings("unchecked")
public @Nullable List<E> list(String attribute, String value) {
 if (value == null)
  return null;
 Query query =  this._cache.createQuery();
 Attribute<String> byId = this._cache.getSearchAttribute(attribute);
 query.addCriteria(byId.eq(value));
 Results results = query.execute();
 List<Result> all = results.all();
 List<E> entities = new ArrayList<>();
 for (Result r : all) {
  entities.add((E)r.getValue());
 }
 return entities;
}

代码示例来源:origin: org.pageseeder.bridge/pso-bridge

/**
 * Retrieve the object in the cache for the specified key.
 *
 * @param attribute The name of the attribute to match.
 * @param value     The value of the attribute to match.
 *
 * @return The version of the element or <code>null</code> if the key or element is <code>null</code>
 */
@SuppressWarnings("unchecked")
public @Nullable E get(String attribute, String value) {
 if (value == null)
  return null;
 @Nullable E o = null;
 Query query =  this._cache.createQuery();
 Attribute<String> byId = this._cache.getSearchAttribute(attribute);
 query.includeValues().addCriteria(byId.eq(value));
 Results results = query.execute();
 List<Result> all = results.all();
 if (all.size() > 0) {
  Result r = all.get(0);
  o = (E)r.getValue();
 }
 return o;
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

Results results = q.execute();
List<Result> all = results.all();
List<Object[]> result = new ArrayList<Object[]>(results.size());

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

Results results = q.execute();
List<Result> all = results.all();
List<Object[]> result = new ArrayList<Object[]>(results.size());

代码示例来源:origin: Jasig/uPortal

usernameSearchAttribute.eq(user.getEntityIdentifier().getKey()))
        .end();
final List<Result> queryResults = query.execute().all();
for (Result r : queryResults) {
  membershipCache.remove(r.getKey());

代码示例来源:origin: org.jasig.portal/uPortal-groups-pags

usernameSearchAttribute.eq(user.getEntityIdentifier().getKey()))
        .end();
final List<Result> queryResults = query.execute().all();
for (Result r : queryResults) {
  membershipCache.remove(r.getKey());

代码示例来源:origin: org.apache.directory.fortress/fortress-core

query.includeValues();
query.addCriteria(member.eq(name).and(context.eq(contextId)));
Results results = query.execute();
boolean empty = false;
for (Result result : results.all())

代码示例来源:origin: org.apache.directory.fortress/fortress-core

query.addCriteria(member.in(roles).and(context.eq(contextId)));
Results results = query.execute();
for (Result result : results.all())

代码示例来源:origin: org.apache.directory.fortress/fortress-core

/**
 * Given DSD entry name, clear its corresponding object values from the cache.
 *
 * @param name contains the name of object to be cleared.
 * @param contextId maps to sub-tree in DIT, e.g. ou=contextId, dc=example, dc=com.     *
 * @throws SecurityException in the event of system or rule violation.
 */
void clearDsdCacheEntry(String name, String contextId)
{
  Attribute<String> context = m_dsdCache.getSearchAttribute(CONTEXT_ID);
  Attribute<String> dsdName = m_dsdCache.getSearchAttribute(DSD_NAME);
  Query query = m_dsdCache.createQuery();
  query.includeKeys();
  query.includeValues();
  query.addCriteria(dsdName.eq(name).and(context.eq(contextId)));
  Results results = query.execute();
  for (Result result : results.all())
  {
    m_dsdCache.clear(result.getKey());
  }
}

相关文章