/// <summary> /// For Inproc only /// </summary> /// <param name="entry"></param> /// <returns></returns> internal static EventCacheItem ConvertToItem(EventCacheEntry entry) { Byte[] objectValue = null; if (entry != null) { EventCacheItem item = new EventCacheItem(); item.CacheItemPriority = (CacheItemPriority)entry.Priority; if (entry.Value != null) { UserBinaryObject ubObject = entry.Value as UserBinaryObject; if (ubObject != null) { objectValue = ubObject.GetFullObject(); item.Value = objectValue; } else { item.Value = entry.Value; } } return(item); } return(null); }
internal static EventCacheItem ConvertToEventEntry(Alachisoft.NCache.Common.Protobuf.EventCacheItem cacheItem) { Byte[] objectValue = null; if (cacheItem == null) { return(null); } EventCacheItem item = new EventCacheItem(); item.CacheItemPriority = (CacheItemPriority)cacheItem.priority; item.CacheItemVersion = new Caching.CacheItemVersion(cacheItem.itemVersion); item.Group = String.IsNullOrEmpty(cacheItem.group) ? null : cacheItem.group; item.ResyncExpiredItems = cacheItem.resyncExpiredItems; item.ResyncProviderName = String.IsNullOrEmpty(cacheItem.resyncProviderName) ? null : cacheItem.resyncProviderName; item.SubGroup = String.IsNullOrEmpty(cacheItem.subGroup) ? null : cacheItem.subGroup; if (cacheItem.value != null && cacheItem.value.Count > 0) { UserBinaryObject ubObject = UserBinaryObject.CreateUserBinaryObject(cacheItem.value.ToArray()); objectValue = ubObject.GetFullObject(); item.Value = objectValue; } return(item); }
/// <summary> /// For Inproc only /// </summary> /// <param name="entry"></param> /// <returns></returns> internal static EventCacheItem ConvertToItem(EventCacheEntry entry) { Byte[] objectValue = null; if (entry != null) { EventCacheItem item = new EventCacheItem(); item.CacheItemPriority = (CacheItemPriority)entry.Priority; item.CacheItemVersion = new Caching.CacheItemVersion(entry.Version); item.Group = entry.Group; item.ResyncExpiredItems = entry.ReSyncExpiredItems; item.ResyncProviderName = entry.ReSyncProviderCacheItem; item.SubGroup = entry.SubGroup; if (entry.Value != null) { UserBinaryObject ubObject = entry.Value as UserBinaryObject; if (ubObject != null) { objectValue = ubObject.GetFullObject(); item.Value = objectValue; } else { item.Value = entry.Value; } } return(item); } return(null); }
public ItemAddedTask(Broker parent, string key, bool notifyAsync, EventCacheItem item, BitSet flag) { this._parent = parent; this._key = key; this._notifyAsync = notifyAsync; this._item = item; this._flag = flag; }
public ItemUpdateCallbackTask(Broker parent, string key, short callBackId, bool notifyAsync, EventCacheItem item, EventCacheItem oldItem, BitSet flag, EventDataFilter dataFilter) { this._parent = parent; this._key = key; this._callBackId = callBackId; this._notifyAsync = notifyAsync; this._item = item; this._oldItem = oldItem; this._flag = flag; this._dataFilter = dataFilter; }
public ItemRemoveEventTask(Broker parent, string key, object value, CacheItemRemovedReason reason, BitSet flag, bool notifyAsync, EventCacheItem item) { this._parent = parent; this._key = key; this._value = value; this._reason = reason; this._flag = flag; this._notifyAsync = notifyAsync; this._item = item; }
public ItemRemoveCallBackTask(Broker parent, string key, short callBackId, object value, CacheItemRemovedReason reason, BitSet flag, bool notifyAsync, EventCacheItem item, EventDataFilter dataFilter) { this._parent = parent; this._key = key; this._callBackId = callBackId; this._value = value; this._reason = reason; this._flag = flag; this._notifyAsync = notifyAsync; this._item = item; this._dataFilter = dataFilter; }
public CQCallBackTask(Broker parent, string key, string queryId, QueryChangeType changeType, bool notifyAsync, EventCacheItem item, EventCacheItem oldItem, BitSet flag, EventDataFilter datafilter) { this._key = key; this._parent = parent; this._notifyAsync = notifyAsync; this._queryId = queryId; this._changeType = changeType; this._item = item; this._oldItem = oldItem; this._flag = flag; this._datafilter = datafilter; }
internal static EventCacheItem ConvertToEventItem(EventCacheEntry entry, EventDataFilter?datafilter) { if (datafilter == EventDataFilter.None || entry == null) { return(null); } EventCacheItem cacheItem = new EventCacheItem(); cacheItem.priority = (int)entry.Priority; UserBinaryObject userBinary = entry.Value as UserBinaryObject; if (userBinary == null) { if (entry.Value is CallbackEntry) { userBinary = ((CallbackEntry)entry.Value).Value as UserBinaryObject; } } if (userBinary != null) { cacheItem.value.AddRange(userBinary.DataList); } //Can be optimized if (datafilter != null) { if (datafilter == EventDataFilter.None) { return(null); } else if (datafilter == EventDataFilter.Metadata) { cacheItem.value.Clear(); } } return(cacheItem); }
internal static EventCacheItem ConvertToEventEntry(Alachisoft.NCache.Common.Protobuf.EventCacheItem cacheItem) { Byte[] objectValue = null; if (cacheItem == null) { return(null); } EventCacheItem item = new EventCacheItem(); item.CacheItemPriority = (CacheItemPriority)cacheItem.priority; if (cacheItem.value != null && cacheItem.value.Count > 0) { UserBinaryObject ubObject = UserBinaryObject.CreateUserBinaryObject(cacheItem.value.ToArray()); objectValue = ubObject.GetFullObject(); item.Value = objectValue; } return(item); }
private static Dictionary <string, EventCacheItem> BuildCache() { var cache = new Dictionary <string, EventCacheItem>(StringComparer.OrdinalIgnoreCase); var events = Assembly.GetExecutingAssembly().GetTypes().Where(x => x.IsSubclassOf(typeof(JournalEvent)) && x.Name.EndsWith("Event")); foreach (var eventClass in events) { var executeMethod = eventClass.GetMethod("Execute", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); if (executeMethod != null) { var item = new EventCacheItem { Type = eventClass, Execute = executeMethod }; cache.Add(item.Name, item); } } return(cache); }
internal static EventCacheItem ConvertToEventItem(EventCacheEntry entry, EventDataFilter?datafilter) { if (datafilter == EventDataFilter.None || entry == null) { return(null); } EventCacheItem cacheItem = new EventCacheItem(); cacheItem.group = entry.Group; cacheItem.subGroup = entry.SubGroup; cacheItem.itemVersion = entry.Version; cacheItem.priority = (int)entry.Priority; cacheItem.resyncExpiredItems = entry.ReSyncExpiredItems; cacheItem.resyncProviderName = entry.ReSyncProviderCacheItem; UserBinaryObject userBinary = getData(entry); if (userBinary != null) { cacheItem.value.AddRange(userBinary.DataList); } // Can be optimized if (datafilter != null) { if (datafilter == EventDataFilter.None) { return(null); } else if (datafilter == EventDataFilter.Metadata) { cacheItem.value.Clear(); } } return(cacheItem); }
internal static EventCacheItem ConvertToEventItem(EventCacheEntry entry, EventDataFilter?datafilter) { if (datafilter == EventDataFilter.None || entry == null) { return(null); } EventCacheItem cacheItem = new EventCacheItem(); cacheItem.group = entry.Group; cacheItem.subGroup = entry.SubGroup; cacheItem.itemVersion = entry.Version; cacheItem.priority = (int)entry.Priority; cacheItem.resyncExpiredItems = entry.ReSyncExpiredItems; cacheItem.resyncProviderName = entry.ReSyncProviderCacheItem; UserBinaryObject userBinary = getData(entry); if (userBinary != null) { cacheItem.value.AddRange(userBinary.DataList); } cacheItem.itemType = Alachisoft.NCache.Util.MiscUtil.EntryTypeToProtoItemType(entry.EntryType); cacheItem.flagMap = entry.Flags.Data; //Can be optimized if (datafilter != null) { if (datafilter == EventDataFilter.None) { return(null); } } return(cacheItem); }