/** * Writes an event to cache, if enabled * * @param event the event object * @param eventId the id of the event object */ private void writeEventToCluster(Event event, Long eventId) { if (cachingEnabled) { if (eventCache != null) { // store event as an element BaseEvent baseEvent = ensureBaseEvent(event); SimpleEvent simpleEvent = new SimpleEvent((Event) baseEvent, serverConfigurationService().getServerIdInstance()); // add item to cache store eventCache.put(String.valueOf(eventId), simpleEvent); // update the last event id each time eventLastCache.put("lastEventId", eventId); } else { log.debug("Cannot store event to cache, event store not initialized."); } } else { log.debug("Cluster caching not enabled."); } }