private void handleCacheUpdate(Object[] args, CacheUpdate cacheUpdate) throws Exception {
    Cache cache = CacheService.getCache(cacheUpdate.cacheName());
    String key =
        generateKey(cacheUpdate.key(), cacheUpdate.keyGenClass(), cacheUpdate.keyGenMethod(), args);

    Object arg = args[cacheUpdate.argNum()];
    Object argUnwrapped = arg;
    if (arg instanceof ValueWrapper) {
      argUnwrapped = ((ValueWrapper) arg).getValue();
    }
    if (argUnwrapped != null || cacheUpdate.cacheNull()) {
      cache.put(key, arg);
    }
  }
  private Object handleCacheable(Method m, Object[] args, Cacheable cacheable) throws Exception {
    Cache cache = CacheService.getCache(cacheable.cacheName());
    String key =
        generateKey(cacheable.key(), cacheable.keyGenClass(), cacheable.keyGenMethod(), args);
    Object cacheResult = cache.get(key);

    if (cacheResult != null) {
      Object result = ((ValueWrapper) cacheResult).getValue();
      if (result instanceof ValueWrapper) {
        ((ValueWrapper) result).setCacheHit(true);
      }
      return result;
    }

    Object result = m.invoke(obj, args);
    Object resultUnwrapped = result;
    if (result instanceof ValueWrapper) {
      resultUnwrapped = ((ValueWrapper) result).getValue();
    }
    if (resultUnwrapped != null || cacheable.cacheNull()) {
      cache.put(key, result);
    }
    return result;
  }