All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ehcache.event.CacheEvent Maven / Gradle / Ivy

There is a newer version: 3.10.8
Show newest version
/*
 * Copyright Terracotta, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.ehcache.event;

import org.ehcache.Cache;

/**
 * An event resulting from a mutative {@link Cache} operation.
 *
 * @param  the key type of the source cache
 * @param  the value type of the source cache
 */
public interface CacheEvent {

  /**
   * Gets the {@link EventType} of this event.
   *
   * @return the {@code EventType}
   */
  EventType getType();

  /**
   * The key of the mapping affected by this event.
   *
   * @return the key of the mutated mapping
   */
  K getKey();

  /**
   * The mapped value immediately after the mutative event occurred.
   * 

* If the mutative event removes the mapping then {@code null} is returned. * * @return the mapped value after the mutation */ V getNewValue(); /** * The mapped value immediately before the mutative event occurred. *

* If the mutative event created the mapping then {@code null} is returned. * * @return the mapped value before the mutation */ V getOldValue(); /** * The source cache for this event *

* Calling back into the cache to perform operations is not supported. It is only provided as a way to identify the * event source. * * @return the source cache */ @Deprecated Cache getSource(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy