code: @Override
      synchronized public void put(String identifier, TemplateContentData templateContentData) {
          if (!locksMap.containsKey(identifier)) {
              locksMap.put(identifier, new Object());
          }
          Object lock = locksMap.get(identifier);
          synchronized (lock) {
              int size = templateContentData.getTemplateContent().length;
              if (size > capacity) {
                  LOGGER.warn(String.format("No caching for template with size: %s larger than total capacity: %s.", size, capacity));
                  return;
              }
              if (templateDataMap.containsKey(identifier)) {
                  LOGGER.info(String.format("Try to put the same template with identifier: %s into cache, removing duplicate entry in queue.", identifier));
                  templateOrderQueue.remove(templateDataMap.get(identifier));
              }
              while (size + capacityCounter.get() > capacity) {
                  AccessOrderedTemplateContentData eldest = templateOrderQueue.poll();
                  TemplateContentData eldestTemplate = eldest.getTemplateContentData();
                  templateDataMap.remove(eldestTemplate.getIdentifier());
                  deductAndGet(eldestTemplate.getTemplateContent().length);
              }
              AccessOrderedTemplateContentData data = AccessOrderedTemplateContentData.builder()
                      .withTemplateContentData(templateContentData)
                      .build();
              templateOrderQueue.offer(data);
              templateDataMap.put(identifier, data);
              capacityCounter.addAndGet(size);
          }
      }
docs: {@inheritDoc}
  
  If template size is larger than total cache capacity, no caching.
  If there's not enough capacity for new entry, remove eldest ones until have capacity to insert.