internal AddCommand(string key, byte[] value, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short removeCallback, short updateCallback, Hashtable queryInfo, BitSet flagMap, string cacheId,EventDataFilter updateDataFilter,EventDataFilter removeDataFilter) { base.name = "AddCommand"; base.key = key; _addCommand = new Alachisoft.NCache.Common.Protobuf.AddCommand(); if (absoluteExpiration != Cache.NoAbsoluteExpiration) _addCommand.absExpiration = absoluteExpiration.Ticks; if (slidingExpiration != Cache.NoSlidingExpiration) _addCommand.sldExpiration = slidingExpiration.Ticks; Alachisoft.NCache.Caching.UserBinaryObject ubObject = Alachisoft.NCache.Caching.UserBinaryObject.CreateUserBinaryObject(value); _addCommand.key = key; _addCommand.data.AddRange(ubObject.DataList); _addCommand.requestId = base.RequestId; _addCommand.updateCallbackId = updateCallback; _addCommand.removeCallbackId = removeCallback; _addCommand.priority = (int)priority; _addCommand.flag = flagMap.Data; _addCommand.updateDataFilter = (short)updateDataFilter; _addCommand.removeDataFilter = (short)removeDataFilter; // Changes made to send Queries, Tags and NamgedTags in a single object ObjectQueryInfo objectQueryInfo = new ObjectQueryInfo(); if (queryInfo["query-info"] != null) objectQueryInfo.queryInfo = ProtobufHelper.GetQueryInfoObj(queryInfo["query-info"] as Hashtable); _addCommand.objectQueryInfo = objectQueryInfo; }
public InsertCommand(string key, byte[] value, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short removeCallback, short updateCallback, Hashtable queryInfo, BitSet flagMap, object lockId, LockAccessType accessType, string cacheId, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter) { base.name = "InsertCommand"; base.key = key; _insertCommand = new Alachisoft.NCache.Common.Protobuf.InsertCommand(); _insertCommand.key = key; Alachisoft.NCache.Caching.UserBinaryObject ubObject = UserBinaryObject.CreateUserBinaryObject(value); _insertCommand.data.AddRange(ubObject.DataList); _insertCommand.requestId = base.RequestId; _insertCommand.removeCallbackId = removeCallback; _insertCommand.updateCallbackId = updateCallback; _insertCommand.updateDataFilter = (short)updateCallbackFilter; _insertCommand.removeDataFilter = (short)removeCallabackFilter; _insertCommand.priority = (int)priority; _insertCommand.flag = flagMap.Data; if(lockId != null) _insertCommand.lockId = lockId.ToString(); _insertCommand.lockAccessType = (int)accessType; if (absoluteExpiration != Web.Caching.Cache.NoAbsoluteExpiration) _insertCommand.absExpiration = absoluteExpiration.Ticks; if (slidingExpiration != Web.Caching.Cache.NoSlidingExpiration) _insertCommand.sldExpiration = slidingExpiration.Ticks; ObjectQueryInfo objectQueryInfo = new ObjectQueryInfo(); if (queryInfo["query-info"] != null) objectQueryInfo.queryInfo = ProtobufHelper.GetQueryInfoObj(queryInfo["query-info"] as Hashtable); _insertCommand.objectQueryInfo = objectQueryInfo; }
public BulkInsertCommand(string[] keys, CacheItem[] items, Cache parent, string cacheId) { base.name = "BulkInsertCommand"; _parent = parent; base.BulkKeys = keys; _bulkInsertCommand = new Alachisoft.NCache.Common.Protobuf.BulkInsertCommand(); _bulkInsertCommand.requestId = base.RequestId; for (int i = 0; i < keys.Length; i++) { CacheItem item = items[i]; _insertCommand = new Alachisoft.NCache.Common.Protobuf.InsertCommand(); _insertCommand.key = keys[i]; Alachisoft.NCache.Caching.UserBinaryObject ubObject = Alachisoft.NCache.Caching.UserBinaryObject.CreateUserBinaryObject((byte[])item.Value); _insertCommand.data.AddRange(ubObject.DataList); if (item.AbsoluteExpiration != Cache.NoAbsoluteExpiration) _insertCommand.absExpiration = item.AbsoluteExpiration.Ticks; if (item.SlidingExpiration != Cache.NoSlidingExpiration) _insertCommand.sldExpiration = item.SlidingExpiration.Ticks; _insertCommand.flag = item.FlagMap.Data; _insertCommand.priority = (int)item.Priority; // Updated in Version 4.2 [Dated 20-Nov-2013; Author: Sami] ObjectQueryInfo objectQueryInfo = new ObjectQueryInfo(); if (item.QueryInfo["query-info"] != null) objectQueryInfo.queryInfo = ProtobufHelper.GetQueryInfoObj(item.QueryInfo["query-info"] as Hashtable); _insertCommand.objectQueryInfo = objectQueryInfo; short removeCallbackId = -1; short updateCallbackId = -1; EventDataFilter itemUpdateDataFilter = EventDataFilter.None; EventDataFilter itemRemovedDataFilter = EventDataFilter.None; if (item.CacheItemRemovedCallback != null) { itemRemovedDataFilter = item.ItemRemovedCallabackDataFilter; short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemRemovedCallback, EventType.ItemRemoved, itemRemovedDataFilter); removeCallbackId = callabackIds[1]; } if (item.CacheItemUpdatedCallback != null) { itemUpdateDataFilter = item.ItemUpdatedCallabackDataFilter; short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemUpdatedCallback, EventType.ItemUpdated, itemUpdateDataFilter); updateCallbackId = callabackIds[0]; } _insertCommand.removeCallbackId = removeCallbackId; _insertCommand.updateCallbackId = updateCallbackId; _insertCommand.updateDataFilter = (short)itemUpdateDataFilter; _insertCommand.removeDataFilter = (short)itemRemovedDataFilter; _bulkInsertCommand.insertCommand.Add(_insertCommand); } }