test_class.declarator: NS = "ABC_NS"
test_class.modifier: private static final
test_class.original_string: private static final String NS = "ABC_NS";
test_class.type: String
test_class.var_name: NS
test_class.declarator: EXPIRATION = 321
test_class.modifier: private static final
test_class.original_string: private static final int EXPIRATION = 321;
test_class.type: int
test_class.var_name: EXPIRATION
test_class.declarator: expectedValue
test_class.modifier: private final
test_class.original_string: private final List<?> expectedValue;
test_class.type: List<?>
test_class.var_name: expectedValue
test_class.declarator: cacheKeys
test_class.modifier: private final
test_class.original_string: private final String[] cacheKeys;
test_class.type: String[]
test_class.var_name: cacheKeys
test_class.file: simple-spring-memcached/src/test/java/com/google/code/ssm/aop/ReadThroughMultiCacheAdviceTest.java
test_class.identifier: ReadThroughMultiCacheAdviceTest
test_class.superclass: extends AbstractCacheTest<ReadThroughMultiCacheAdvice>
test_case.body: @Test
      public void validCacheAllMiss() throws Throwable {
          Assume.assumeTrue(isValid);
  
          when(pjp.proceed(params)).thenReturn(expectedValue);
  
          assertEquals(expectedValue, advice.cacheMulti(pjp));
  
          verify(cache).getBulk(eq(new HashSet<String>(Arrays.asList(cacheKeys))), any(SerializationType.class));
          for (int i = 0; i < cacheKeys.length; i++) {
              verify(cache).setSilently(eq(cacheKeys[i]), eq(EXPIRATION), eq(expectedValue.get(i)), any(SerializationType.class));
          }
          verify(pjp).proceed(params);
      }
test_case.class_method_signature: ReadThroughMultiCacheAdviceTest.validCacheAllMiss()
test_case.full_signature: @Test public void validCacheAllMiss()
test_case.identifier: validCacheAllMiss
test_case.invocations: assumeTrue thenReturn when proceed assertEquals cacheMulti getBulk verify eq asList any setSilently verify eq eq eq get any proceed verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void validCacheAllMiss()
focal_class.declarator: LOG = LoggerFactory.getLogger(ReadThroughMultiCacheAdvice.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(ReadThroughMultiCacheAdvice.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.file: simple-spring-memcached/src/main/java/com/google/code/ssm/aop/ReadThroughMultiCacheAdvice.java
focal_class.identifier: ReadThroughMultiCacheAdvice
focal_class.class_method_signature: ReadThroughMultiCacheAdvice.getMulti()
focal_class.full_signature: @Pointcut("@annotation(com.google.code.ssm.api.ReadThroughMultiCache)") public void getMulti()
focal_class.identifier: getMulti
focal_class.modifiers: @Pointcut("@annotation(com.google.code.ssm.api.ReadThroughMultiCache)") public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void getMulti()
focal_class.class_method_signature: ReadThroughMultiCacheAdvice.cacheMulti(final ProceedingJoinPoint pjp)
focal_class.full_signature: @Around("getMulti()") @SuppressWarnings("unchecked") public Object cacheMulti(final ProceedingJoinPoint pjp)
focal_class.identifier: cacheMulti
focal_class.modifiers: @Around("getMulti()") @SuppressWarnings("unchecked") public
focal_class.parameters: (final ProceedingJoinPoint pjp)
focal_class.return: Object
focal_class.signature: Object cacheMulti(final ProceedingJoinPoint pjp)
focal_class.class_method_signature: ReadThroughMultiCacheAdvice.setMultiCacheOptions(final MultiCacheCoordinator coord, final ReadThroughMultiCacheOption options)
focal_class.full_signature: private void setMultiCacheOptions(final MultiCacheCoordinator coord, final ReadThroughMultiCacheOption options)
focal_class.identifier: setMultiCacheOptions
focal_class.modifiers: private
focal_class.parameters: (final MultiCacheCoordinator coord, final ReadThroughMultiCacheOption options)
focal_class.return: void
focal_class.signature: void setMultiCacheOptions(final MultiCacheCoordinator coord, final ReadThroughMultiCacheOption options)
focal_class.class_method_signature: ReadThroughMultiCacheAdvice.generateByKeysFromResult(final List<Object> results, final MultiCacheCoordinator coord,
              final SerializationType serializationType)
focal_class.full_signature: private List<?> generateByKeysFromResult(final List<Object> results, final MultiCacheCoordinator coord,
              final SerializationType serializationType)
focal_class.identifier: generateByKeysFromResult
focal_class.modifiers: private
focal_class.parameters: (final List<Object> results, final MultiCacheCoordinator coord,
              final SerializationType serializationType)
focal_class.return: List<?>
focal_class.signature: List<?> generateByKeysFromResult(final List<Object> results, final MultiCacheCoordinator coord,
              final SerializationType serializationType)
focal_class.class_method_signature: ReadThroughMultiCacheAdvice.generateByKeysProviders(final List<Object> results, final MultiCacheCoordinator coord,
              final SerializationType serializationType)
focal_class.full_signature: private List<?> generateByKeysProviders(final List<Object> results, final MultiCacheCoordinator coord,
              final SerializationType serializationType)
focal_class.identifier: generateByKeysProviders
focal_class.modifiers: private
focal_class.parameters: (final List<Object> results, final MultiCacheCoordinator coord,
              final SerializationType serializationType)
focal_class.return: List<?>
focal_class.signature: List<?> generateByKeysProviders(final List<Object> results, final MultiCacheCoordinator coord,
              final SerializationType serializationType)
focal_class.class_method_signature: ReadThroughMultiCacheAdvice.getLogger()
focal_class.full_signature: @Override protected Logger getLogger()
focal_class.identifier: getLogger
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: Logger
focal_class.signature: Logger getLogger()
focal_class.superclass: extends MultiCacheAdvice
focal_method.body: @Around("getMulti()")
      @SuppressWarnings("unchecked")
      public Object cacheMulti(final ProceedingJoinPoint pjp) throws Throwable {
          if (isDisabled()) {
              getLogger().info("Cache disabled");
              return pjp.proceed();
          }
  
          // This is injected caching. If anything goes wrong in the caching, LOG
          // the crap outta it, but do not let it surface up past the AOP injection itself.
          final ReadThroughMultiCache annotation;
          final MultiCacheCoordinator coord;
          final AnnotationData data;
          final SerializationType serializationType;
  
          Object[] args = pjp.getArgs();
          try {
              // Get the target method being invoked, and make sure it returns the correct info.
              final Method methodToCache = getCacheBase().getMethodToCache(pjp, ReadThroughMultiCache.class);
              getCacheBase().verifyReturnTypeIsList(methodToCache, ReadThroughMultiCache.class);
  
              // Get the annotation associated with this method, and make sure the values are valid.
              annotation = methodToCache.getAnnotation(ReadThroughMultiCache.class);
              serializationType = getCacheBase().getSerializationType(methodToCache);
  
              data = AnnotationDataBuilder.buildAnnotationData(annotation, ReadThroughMultiCache.class, methodToCache);
              coord = new MultiCacheCoordinator(methodToCache, data);
              setMultiCacheOptions(coord, annotation.option());
  
              // Create key->object and object->key mappings.
              coord.setHolder(createObjectIdCacheKeyMapping(data, args, coord.getMethod()));
  
              List<Object> listKeyObjects = (List<Object>) Utils.getMethodArg(data.getListIndexInMethodArgs(), args, coord.getMethod()
                      .toString());
              coord.setListKeyObjects(listKeyObjects);
  
              // Get the full list of cache keys and ask the cache for the corresponding values.
              coord.setInitialKey2Result(getCacheBase().getCache(data).getBulk(coord.getKey2Obj().keySet(), serializationType));
  
              // We've gotten all positive cache results back, so build up a results list and return it.
              if (coord.getMissedObjects().isEmpty()) {
                  return coord.generateResultList();
              }
  
              // Create the new list of arguments with a subset of the key objects that aren't in the cache. Do not modify
              // directly argument array from join point!
              args = coord.createModifiedArgumentList(args);
          } catch (Exception ex) {
              warn(ex, "Caching on %s aborted due to an error.", pjp.toShortString());
              return pjp.proceed();
          }
  
          /*
           * Call the target method with the new subset of arguments. We are calling this outside of the try/catch block
           * in case there are some 'not our fault' problems with the target method. (Connection issues, etc...) Though,
           * this decision could go either way, really.
           */
          final List<Object> results = (List<Object>) pjp.proceed(args);
  
          try {
              // there are no results
              if (results == null || results.isEmpty()) {
                  if (coord.isAddNullsToCache()) {
                      addNullValues(coord.getMissedObjects(), coord, serializationType);
                  }
                  return coord.generatePartialResultList();
              }
  
              if (coord.isGenerateKeysFromResult()) {
                  return generateByKeysFromResult(results, coord, serializationType);
              } else {
                  return generateByKeysProviders(results, coord, serializationType);
              }
          } catch (Exception ex) {
              warn(ex, "Caching on %s aborted due to an error. The underlying method will be called twice.", pjp.toShortString());
              // invoke underlying method again using unmodified arguments array
              return pjp.proceed(pjp.getArgs());
          }
      }
focal_method.class_method_signature: ReadThroughMultiCacheAdvice.cacheMulti(final ProceedingJoinPoint pjp)
focal_method.full_signature: @Around("getMulti()") @SuppressWarnings("unchecked") public Object cacheMulti(final ProceedingJoinPoint pjp)
focal_method.identifier: cacheMulti
focal_method.invocations: isDisabled info getLogger proceed getArgs getMethodToCache getCacheBase verifyReturnTypeIsList getCacheBase getAnnotation getSerializationType getCacheBase buildAnnotationData setMultiCacheOptions option setHolder createObjectIdCacheKeyMapping getMethod getMethodArg getListIndexInMethodArgs toString getMethod setListKeyObjects setInitialKey2Result getBulk getCache getCacheBase keySet getKey2Obj isEmpty getMissedObjects generateResultList createModifiedArgumentList warn toShortString proceed proceed isEmpty isAddNullsToCache addNullValues getMissedObjects generatePartialResultList isGenerateKeysFromResult generateByKeysFromResult generateByKeysProviders warn toShortString proceed getArgs
focal_method.modifiers: @Around("getMulti()") @SuppressWarnings("unchecked") public
focal_method.parameters: (final ProceedingJoinPoint pjp)
focal_method.return: Object
focal_method.signature: Object cacheMulti(final ProceedingJoinPoint pjp)