Modul ncache.client.CacheEventArg

Erweitern Sie den Quellcode
from ncache.client.CacheEventDescriptor import CacheEventDescriptor
from ncache.client.EventArg import EventArg
from ncache.client.enum.CacheItemRemovedReason import CacheItemRemovedReason
from ncache.client.enum.EventType import EventType
from ncache.runtime.util.EnumUtil import EnumUtil


class CacheEventArg(EventArg):
    """
    This object is received when an event is raised and listener is called. CacheEventArg contains necessary information
    to identify the event and perform necessary actions accordingly. This class is consistent for both selective and
    general events
    """
    def __init__(self, value):
        super().__init__(value)
        self.__cacheeventarg = value

    def get_cache_item_removed_reason(self):
        """
        Only applicable for EventType.ITEM_REMOVE Otherwise default value is DependencyChanged

        :return: The CacheItemRemovedReason enum
        :rtype: CacheItemRemovedReason
        """
        reason = self.__cacheeventarg.getCacheItemRemovedReason()

        if reason is not None:
            reason = EnumUtil.get_cache_item_removed_reason_value(reason)

        return reason

    def get_descriptor(self):
        """
        Only applicable for general events otherwise it will be None

        :return: The descriptor associated with the cache event args.
        :rtype: CacheEventDescriptor or None
        """
        descriptor = self.__cacheeventarg.getDescriptor()
        if descriptor is not None:
            return CacheEventDescriptor(descriptor)

    def get_event_type(self):
        """
        Event Type the event is raised against.

        :return: The event type associated with the EventArgs.
        :rtype: EventType
        """
        eventtype = self.__cacheeventarg.getEventType()

        if eventtype is not None:
            eventtype = EnumUtil.get_event_type_value(eventtype)

        return eventtype

Klassen

class CacheEventArg (value)

Dieses Objekt wird empfangen, wenn ein Ereignis ausgelöst und ein Listener aufgerufen wird. CacheEventArg enthält die notwendigen Informationen, um das Ereignis zu identifizieren und die erforderlichen Aktionen entsprechend durchzuführen. Diese Klasse ist sowohl für selektive als auch für allgemeine Ereignisse konsistent

Erweitern Sie den Quellcode
class CacheEventArg(EventArg):
    """
    This object is received when an event is raised and listener is called. CacheEventArg contains necessary information
    to identify the event and perform necessary actions accordingly. This class is consistent for both selective and
    general events
    """
    def __init__(self, value):
        super().__init__(value)
        self.__cacheeventarg = value

    def get_cache_item_removed_reason(self):
        """
        Only applicable for EventType.ITEM_REMOVE Otherwise default value is DependencyChanged

        :return: The CacheItemRemovedReason enum
        :rtype: CacheItemRemovedReason
        """
        reason = self.__cacheeventarg.getCacheItemRemovedReason()

        if reason is not None:
            reason = EnumUtil.get_cache_item_removed_reason_value(reason)

        return reason

    def get_descriptor(self):
        """
        Only applicable for general events otherwise it will be None

        :return: The descriptor associated with the cache event args.
        :rtype: CacheEventDescriptor or None
        """
        descriptor = self.__cacheeventarg.getDescriptor()
        if descriptor is not None:
            return CacheEventDescriptor(descriptor)

    def get_event_type(self):
        """
        Event Type the event is raised against.

        :return: The event type associated with the EventArgs.
        :rtype: EventType
        """
        eventtype = self.__cacheeventarg.getEventType()

        if eventtype is not None:
            eventtype = EnumUtil.get_event_type_value(eventtype)

        return eventtype

Vorfahren

Methoden

def get_cache_item_removed_reason(self)

Gilt nur für EventType.ITEM_REMOVE. Andernfalls ist der Standardwert DependencyChanged

:return: Die CacheItemRemovedReason-Enumeration :rtype: CacheItemRemovedReason

Erweitern Sie den Quellcode
def get_cache_item_removed_reason(self):
    """
    Only applicable for EventType.ITEM_REMOVE Otherwise default value is DependencyChanged

    :return: The CacheItemRemovedReason enum
    :rtype: CacheItemRemovedReason
    """
    reason = self.__cacheeventarg.getCacheItemRemovedReason()

    if reason is not None:
        reason = EnumUtil.get_cache_item_removed_reason_value(reason)

    return reason
def get_descriptor(self)

Gilt nur für allgemeine Veranstaltungen, andernfalls gilt „Keine“.

:return: Der mit den Cache-Ereignisargumenten verknüpfte Deskriptor. :rtype: CacheEventDescriptor oder None

Erweitern Sie den Quellcode
def get_descriptor(self):
    """
    Only applicable for general events otherwise it will be None

    :return: The descriptor associated with the cache event args.
    :rtype: CacheEventDescriptor or None
    """
    descriptor = self.__cacheeventarg.getDescriptor()
    if descriptor is not None:
        return CacheEventDescriptor(descriptor)

Geerbte Mitglieder