@Override
  public synchronized void add(final T taskData) {
    assertNotClosed();
    if (cacheSize() >= maxCacheSize) {
      // Too many tasks in the cache, push this to the underlying collection
      wrappedCollection.add(taskData);
      return;
    }

    Task<T> newTask = new CachedTask<>(this, taskData);
    cache.add(newTask);
  }
Instantiates a new Caching task collection.

@param collection the collection
services/tasks/src/main/java/org/hyperledger/besu/services/tasks/CachingTaskCollection.java