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; }
public static EventCacheEntry ReadItemInfo(CompactReader reader) { bool flag = reader.ReadBoolean(); if (flag) { EventCacheEntry item = new EventCacheEntry(); item.Deserialize(reader); return(item); } return(null); }
internal static void WriteItemInfo(CompactWriter writer, EventCacheEntry item) { if (item == null) { writer.Write(false); return; } else { writer.Write(true); item.Serialize(writer); } }
public static EventCacheEntry CreateCacheEventEntry(EventDataFilter? filter, CacheEntry cacheEntry) { if (filter != EventDataFilter.None && cacheEntry != null) { cacheEntry = (CacheEntry)cacheEntry.Clone(); EventCacheEntry entry = new EventCacheEntry(cacheEntry); entry.Flags = cacheEntry.Flag; if (filter == EventDataFilter.DataWithMetadata) { if (cacheEntry.Value is CallbackEntry) { entry.Value = ((CallbackEntry)cacheEntry.Value).Value; } else entry.Value = cacheEntry.Value; } return entry; } return null; }
/// <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; }