001package io.ebean.annotation;
002
003import java.lang.annotation.ElementType;
004import java.lang.annotation.Retention;
005import java.lang.annotation.RetentionPolicy;
006import java.lang.annotation.Target;
007
008/**
009 * This is put on entity bean types that themselves are not L2 cached directly but are
010 * instead joined to other entity beans that are query cached.
011 * <p>
012 * For example, we could put this on an Address entity bean that is not cached but is joined
013 * to a Customer bean that is query cached.
014 * </p>
015 * <p>
016 * When this is put on an entity bean it means that Insert, Update or Delete changes result in
017 * a single table modification event that is sent around the cluster. This event is used to
018 * invalidate query caches where the entries have joined to this table.
019 * </p>
020 * <p>
021 * For example, a query on Customer that joins to Address is cached. When an Address is changed
022 * that address table modification event is propagated and effectively invalidates query cache
023 * entries that are dependent on the address table.
024 * </p>
025 */
026@Target({ElementType.TYPE})
027@Retention(RetentionPolicy.RUNTIME)
028public @interface InvalidateQueryCache {
029
030  /**
031   * Specify a named cache region.
032   * <p>
033   * The "default" region is called <code>r0</code>.
034   * </p>
035   */
036  String region() default "r0";
037}