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

com.alachisoft.ncache.client.CacheEventArg Maven / Gradle / Ivy

package com.alachisoft.ncache.client;

import com.alachisoft.ncache.client.internal.caching.CacheItemRemovedReason;
import com.alachisoft.ncache.runtime.events.EventType;

/**
 * This object is received when an event is raised and listener {@link CacheDataModificationListener}  is executed
 * CacheEventArg contains necessary information to identify the event and perform necessary actions accordingly.
 * It inherits {@link EventArg}.
 * This class is consistent for both selective and general events
 */
public class CacheEventArg extends EventArg {

    private CacheItemRemovedReason _reason; //For remove only
    private CacheEventDescriptor _descriptor;

    /**
     * @hidden
     * @param key
     * @param cachename
     * @param eventType
     * @param item
     * @param discriptor
     */
    public CacheEventArg(String key, String cachename, EventType eventType, EventCacheItem item, CacheEventDescriptor discriptor) {
        super(cachename, eventType, item);
        _descriptor = discriptor;
    }

    /**
     * @hidden
     * @param key
     * @param cachename
     * @param eventType
     * @param item
     * @param discriptor
     * @param olditem
     */
    public CacheEventArg(String key, String cachename, EventType eventType, EventCacheItem item, CacheEventDescriptor discriptor, EventCacheItem olditem) {
        super(cachename, eventType, item, olditem);
        _descriptor = discriptor;
    }


    /**
     * @hidden
     * @param key
     * @param cachename
     * @param eventType
     * @param item
     * @param discriptor
     * @param reason
     */
    public CacheEventArg(String key, String cachename, EventType eventType, EventCacheItem item, CacheEventDescriptor discriptor, CacheItemRemovedReason reason) {
        super(cachename, eventType, item);
        _reason = reason;
        _descriptor = discriptor;
    }



    /**
     * Only applicable for general events otherwise it will be null.
     * @return The descriptor associated with the cache event args.
     */
    public final CacheEventDescriptor getDescriptor() {
        return _descriptor;
    }

    /**
     * @hidden
     * @param value
     */
    public final void setDescriptor(CacheEventDescriptor value) {
        _descriptor = value;
    }

    /**
     * Only applicable for EventType.ItemRemove
     * Otherwise default value is DependencyChanged.
     * @return The CacheItemRemovedReason enum.
     */
    public final CacheItemRemovedReason getCacheItemRemovedReason() {
        return _reason;
    }

    /**
     * @hidden
     * @param value
     */
    public final void setItemRemovedReason(CacheItemRemovedReason value) {
        _reason = value;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy