org.infinispan.Cache.getOrDefault()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(206)

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

Cache.getOrDefault介绍

暂无

代码示例

代码示例来源:origin: org.infinispan/infinispan-core

public void testGetOrDefault() {
 cache.put("A", "B");
 assertEquals("K", cache.getOrDefault("Not there", "K"));
}

代码示例来源:origin: org.infinispan/infinispan-core

public void testGetOrDefault() {
 cache.put("A", "B");
 assertEquals("K", cache.getOrDefault("Not there", "K"));
}

代码示例来源:origin: hibernate/hibernate-ogm

/**
 * Returns the result of a stored procedure executed on the backend.
 *
 * @param embeddedCacheManager embedded cache manager
 * @param storedProcedureName name of stored procedure
 * @param queryParameters parameters passed for this query
 * @param classLoaderService the class loader service
 *
 * @return a {@link ClosableIterator} with the result of the query
 */
public ClosableIterator<Tuple> callStoredProcedure(EmbeddedCacheManager embeddedCacheManager, String storedProcedureName, ProcedureQueryParameters queryParameters, ClassLoaderService classLoaderService ) {
  validate( queryParameters );
  Cache<String, String> cache = embeddedCacheManager.getCache( STORED_PROCEDURES_CACHE_NAME, true );
  String className = cache.getOrDefault( storedProcedureName, storedProcedureName );
  Callable<?> callable = instantiate( storedProcedureName, className, classLoaderService );
  setParams( storedProcedureName, queryParameters, callable );
  Object res = execute( storedProcedureName, embeddedCacheManager, callable );
  return extractResultSet( storedProcedureName, res );
}

代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-infinispan-embedded

/**
 * Returns the result of a stored procedure executed on the backend.
 *
 * @param embeddedCacheManager embedded cache manager
 * @param storedProcedureName name of stored procedure
 * @param queryParameters parameters passed for this query
 * @param classLoaderService the class loader service
 *
 * @return a {@link ClosableIterator} with the result of the query
 */
public ClosableIterator<Tuple> callStoredProcedure(EmbeddedCacheManager embeddedCacheManager, String storedProcedureName, ProcedureQueryParameters queryParameters, ClassLoaderService classLoaderService ) {
  validate( queryParameters );
  Cache<String, String> cache = embeddedCacheManager.getCache( STORED_PROCEDURES_CACHE_NAME, true );
  String className = cache.getOrDefault( storedProcedureName, storedProcedureName );
  Callable<?> callable = instantiate( storedProcedureName, className, classLoaderService );
  setParams( storedProcedureName, queryParameters, callable );
  Object res = execute( storedProcedureName, embeddedCacheManager, callable );
  return extractResultSet( storedProcedureName, res );
}

相关文章