@Override
  public void replace(List<ApiType> list, String resourceVersion) {
    lock.lock();
    try {
      Map<String, ApiType> newItems = new HashMap<>();
      for (ApiType item : list) {
        String key = keyFunc.apply(item);
        newItems.put(key, item);
      }
      this.items = newItems;

      // rebuild any index
      this.indices = new HashMap<>();
      for (Map.Entry<String, ApiType> itemEntry : items.entrySet()) {
        this.updateIndices(null, itemEntry.getValue(), itemEntry.getKey());
      }
    } finally {
      lock.unlock();
    }
  }
@ Override public void replace ( List < ApiType > list , String resourceVersion ) { lock . lock ( ) ; try { Map < String , ApiType > newItems = new HashMap < > ( ) ; for ( ApiType item : list ) { String key = keyFunc . apply ( item ) ; newItems . put ( key , item ) ; } this . items = newItems ; this . indices = new HashMap < > ( ) ; for ( Map . Entry < String , ApiType > itemEntry : items . entrySet ( ) ) { this . updateIndices ( null , itemEntry . getValue ( ) , itemEntry . getKey ( ) ) ; } } finally { lock . unlock ( ) ; } }
Replace the content in the cache completely.

@param list the list
@param resourceVersion the resource version