public virtual void OnCustomRemoveCallback(string key, object value, ItemRemoveReason reason, BitSet Flag,
                                                   bool notifyAsync)
        {
            try
            {
                object[] args = value as object[];
                if (args != null)
                {
                    object val = args[0];

                    if (value is UserBinaryObject)
                    {
                        value = ((UserBinaryObject)value).GetFullObject();
                    }

                    CallbackInfo cbInfo = args[1] as CallbackInfo;
                    if (cbInfo != null)
                    {
                        val = _parent.SafeDeserialize(val, _parent._serializationContext, Flag);
                        int processid = System.Diagnostics.Process.GetCurrentProcess().Id;

                        CacheItemRemovedCallback cb =
                            (CacheItemRemovedCallback)_parent.CallbackIDsMap.GetResource(cbInfo.Callback);
                        if (cb != null)
                        {
                            if (notifyAsync)
                            {
#if !NETCORE
                                cb.BeginInvoke(key, val, WebCacheHelper.GetWebItemRemovedReason(reason), null,
                                               null);
#elif NETCORE
                                TaskFactory factory = new TaskFactory();
                                Task        task    = factory.StartNew(() => cb(key, val, WebCacheHelper.GetWebItemRemovedReason(reason)));
#endif
                            }
                            else
                            {
                                cb(key, value, WebCacheHelper.GetWebItemRemovedReason(reason));
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }
        public virtual void OnItemRemoved(string key, object value, CacheItemRemovedReason reason, bool notifyAsync)
        {
            try
            {
                if (_parent.ItemRemovedEventHandle != null)
                {
                    Delegate[] dltList = _parent.ItemRemovedEventHandle.GetInvocationList();
                    for (int i = dltList.Length - 1; i >= 0; i--)
                    {
                        CacheItemRemovedCallback subscriber = (CacheItemRemovedCallback)dltList[i];
                        try
                        {
                            if (notifyAsync)
                            {
#if !NETCORE
                                subscriber.BeginInvoke((string)key, value, reason, null, null);
#elif NETCORE
                                TaskFactory factory = new TaskFactory();
                                Task        task    = factory.StartNew(() => subscriber(key, value, reason));
#endif
                            }
                            else
                            {
                                subscriber((string)key, value, reason);
                            }
                        }
                        catch (Exception e)
                        {
                        }
                    }
                }
            }
            catch
            {
            }
        }