code: @Override
      public synchronized Object store(String projectId, String eventCollection,
                                       String event) throws IOException {
  
          // Create a key from the project ID and event collection.
          String key = String.format(Locale.US, "%s$%s", projectId, eventCollection);
  
          // Get the list of events for the specified key. If no list exists yet, create one.
          List<Long> collectionEvents = collectionIds.get(key);
          if (collectionEvents == null) {
              collectionEvents = new ArrayList<Long>();
              collectionIds.put(key, collectionEvents);
          }
  
          // Remove the oldest events until there is room for at least one more event.
          while (collectionEvents.size() >= maxEventsPerCollection) {
              long idToRemove = collectionEvents.remove(0);
              events.remove(idToRemove);
          }
  
          // Add the event to the event store, add its ID to the collection's list, and return the ID.
          long id = getNextId();
          events.put(id, event);
          collectionEvents.add(id);
          return id;
      }
docs: {@inheritDoc}