Ejemplo n.º 1
0
        public RemoveCommand(string key, BitSet flagMap, short itemRemoved, bool isAsync, short onDsItemRemovedId,
                             object lockId, ulong version, LockAccessType accessType, string providerName, int methodOverload)
        {
            base.name = "RemoveCommand";
            base.asyncCallbackSpecified = isAsync && itemRemoved != -1 ? true : false;
            base.isAsync = isAsync;
            base.key     = key;

            _removeCommand              = new Alachisoft.NCache.Common.Protobuf.RemoveCommand();
            _removeCommand.key          = key;
            _removeCommand.isAsync      = isAsync;
            _removeCommand.providerName = providerName;

            flagMap.SetBit(BitSetConstants.LockedItem);
            _removeCommand.flag = flagMap.Data;

            _removeCommand.datasourceItemRemovedCallbackId = onDsItemRemovedId;
            if (lockId != null)
            {
                _removeCommand.lockId = lockId.ToString();
            }
            _removeCommand.lockAccessType = (int)accessType;
            _removeCommand.version        = version;
            _removeCommand.requestId      = base.RequestId;
            _methodOverload = methodOverload;
            _itemRemoved    = itemRemoved;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        public static string ToString(LockAccessType accessType)
        {
            switch (accessType)
            {
            case LockAccessType.ACQUIRE:
                return("1");

            case LockAccessType.DONT_ACQUIRE:
                return("2");

            case LockAccessType.RELEASE:
                return("3");

            case LockAccessType.DONT_RELEASE:
                return("4");

            case LockAccessType.IGNORE_LOCK:
                return("5");

            case LockAccessType.COMPARE_VERSION:
                return("6");

            case LockAccessType.GET_VERSION:
                return("7");

            case LockAccessType.MATCH_VERSION:
                return("8");

            case LockAccessType.PRESERVE_VERSION:
                return("9");
            }
            return(string.Empty);
        }
Ejemplo n.º 4
0
        public CompactCacheEntry(object key, object value, ExpirationHint dependency,
                                 long expiration,
                                 byte options, object itemRemovedCallback, string group, string subgroup, Hashtable queryInfo, BitSet Flag, object lockId, ulong version, LockAccessType accessType, string providername, string resyncProviderName, Notifications callbackEntry)
        {
            _key   = key;
            _flag  = Flag;
            _value = value;

            _dependency          = dependency;
            _expiration          = expiration;
            _options             = options;
            _itemRemovedCallback = itemRemovedCallback;
            if (group != null)
            {
                _group = group;
                if (subgroup != null)
                {
                    _subgroup = subgroup;
                }
            }
            _queryInfo = queryInfo;

            _lockId             = lockId;
            _accessType         = accessType;
            _version            = version;
            _providerName       = providername;
            _resyncProviderName = resyncProviderName;
            _callbackEntry      = callbackEntry;
        }
Ejemplo n.º 5
0
        public GetCommand(string key, BitSet flagMap, string group, string subGroup, LockAccessType accessType,
                          object lockId, TimeSpan lockTimeout, ulong version, string providerName, int threadId, int methodOverload)
        {
            base.name = "GetCommand";
            base.key  = key;

            _getCommand          = new Alachisoft.NCache.Common.Protobuf.GetCommand();
            _getCommand.key      = key;
            _getCommand.group    = group;
            _getCommand.subGroup = subGroup;
            _getCommand.flag     = flagMap.Data;

            _getCommand.lockInfo = new Alachisoft.NCache.Common.Protobuf.LockInfo();
            _getCommand.lockInfo.lockAccessType = (int)accessType;
            if (lockId != null)
            {
                _getCommand.lockInfo.lockId = lockId.ToString();
            }
            _getCommand.lockInfo.lockTimeout = lockTimeout.Ticks;

            _getCommand.version      = version;
            _getCommand.providerName = providerName;

            _getCommand.requestId = base.RequestId;
            _getCommand.threadId  = threadId;
            _methodOverload       = methodOverload;
        }
Ejemplo n.º 6
0
 public virtual CacheItemVersion Insert(string key, object value, CacheDependency dependency,
                                        CacheSyncDependency syncDependency, DateTime absoluteExpiration,
                                        TimeSpan slidingExpiration, CacheItemPriority priority, short onRemoveCallback, short onUpdateCallback,
                                        short onDsItemUpdatedCallback, bool isResyncExpiredItems,
                                        string group, string subGroup, Hashtable queryInfo, BitSet flagMap, object lockId, CacheItemVersion version,
                                        LockAccessType accessType, string providerName,
                                        string resyncProviderName, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter,
                                        long size, string clientId, CallbackType callbackType = CallbackType.PushBasedNotification)
 {
     return(null);
 }
Ejemplo n.º 7
0
        //Delete that can be use to Delete nay item in cache by providing only key
        public virtual void Delete(string key)
        {
            LockHandle lockHandle = null;

            LockAccessType accessType = LockAccessType.IGNORE_LOCK;
            object         lockId     = (lockHandle == null) ? null : lockHandle.LockId;
            BitSet         flagMap    = new BitSet();
            short          dsItemRemovedCallbackId = -1;

            this.Delete(key, flagMap, dsItemRemovedCallbackId, lockId, accessType);
        }
Ejemplo n.º 8
0
        public DeleteCommand(string key, BitSet flagMap, object lockId, LockAccessType accessType)
        {
            base.name = "DeleteCommand";
            base.key = key;

            _deleteCommand = new Alachisoft.NCache.Common.Protobuf.DeleteCommand();
            _deleteCommand.key = key;

            flagMap.SetBit(BitSetConstants.LockedItem);
            _deleteCommand.flag = flagMap.Data;
            if (lockId != null) _deleteCommand.lockId = lockId.ToString();
            _deleteCommand.lockAccessType = (int)accessType;
            _deleteCommand.requestId = base.RequestId;
        }
Ejemplo n.º 9
0
        public GetCacheItemCommand(string key, BitSet flagMap, LockAccessType accessType, object lockId, TimeSpan lockTimeout)
        {
            base.name = "GetCacheItemCommand";
            base.key = key;

            _getCacheItemCommand = new Alachisoft.NCache.Common.Protobuf.GetCacheItemCommand();
            _getCacheItemCommand.key = key;
            _getCacheItemCommand.requestId = base.RequestId;
            _getCacheItemCommand.flag = flagMap.Data;

            _getCacheItemCommand.lockInfo = new Alachisoft.NCache.Common.Protobuf.LockInfo();
            _getCacheItemCommand.lockInfo.lockAccessType = (int)accessType;
            if (lockId != null)  _getCacheItemCommand.lockInfo.lockId = lockId.ToString();
            _getCacheItemCommand.lockInfo.lockTimeout = lockTimeout.Ticks;
        }
Ejemplo n.º 10
0
 public CompactCacheEntry(object key, object value, ExpirationHint dependency,
                          long expiration,
                          byte options, object itemRemovedCallback, Hashtable queryInfo, BitSet Flag, object lockId, LockAccessType accessType)
 {
     _key                 = key;
     _flag                = Flag;
     _value               = value;
     _dependency          = dependency;
     _expiration          = expiration;
     _options             = options;
     _itemRemovedCallback = itemRemovedCallback;
     _queryInfo           = queryInfo;
     _lockId              = lockId;
     _accessType          = accessType;
 }
Ejemplo n.º 11
0
 public CompactCacheEntry(object key, object value, ExpirationHint dependency, 
     long expiration, 
     byte options, object itemRemovedCallback, Hashtable queryInfo, BitSet Flag, object lockId, LockAccessType accessType)
 {
     _key = key;
     _flag = Flag;
     _value = value;
     _dependency = dependency;
     _expiration = expiration;
     _options = options;
     _itemRemovedCallback = itemRemovedCallback;
     _queryInfo = queryInfo;
     _lockId = lockId;
     _accessType = accessType;
 }
Ejemplo n.º 12
0
        public DeleteCommand(string key, BitSet flagMap, object lockId, LockAccessType accessType)
        {
            base.name = "DeleteCommand";
            base.key  = key;

            _deleteCommand     = new Alachisoft.NCache.Common.Protobuf.DeleteCommand();
            _deleteCommand.key = key;

            flagMap.SetBit(BitSetConstants.LockedItem);
            _deleteCommand.flag = flagMap.Data;
            if (lockId != null)
            {
                _deleteCommand.lockId = lockId.ToString();
            }
            _deleteCommand.lockAccessType = (int)accessType;
            _deleteCommand.requestId      = base.RequestId;
        }
Ejemplo n.º 13
0
        public GetCacheItemCommand(string key, BitSet flagMap, LockAccessType accessType, object lockId, TimeSpan lockTimeout, int methodOverload)
        {
            base.name = "GetCacheItemCommand";
            base.key  = key;

            _getCacheItemCommand           = new Alachisoft.NCache.Common.Protobuf.GetCacheItemCommand();
            _getCacheItemCommand.key       = key;
            _getCacheItemCommand.requestId = base.RequestId;
            _getCacheItemCommand.flag      = flagMap.Data;
            _getCacheItemCommand.lockInfo  = new Alachisoft.NCache.Common.Protobuf.LockInfo();
            _getCacheItemCommand.lockInfo.lockAccessType = (int)accessType;
            if (lockId != null)
            {
                _getCacheItemCommand.lockInfo.lockId = lockId.ToString();
            }
            _getCacheItemCommand.lockInfo.lockTimeout = lockTimeout.Ticks;
            _methodOverload = methodOverload;
        }
Ejemplo n.º 14
0
        private void RemoveEPCacheEntry(string key, EPCacheEntry epCacheEntry, BitSet flag, String writethruProvider)
        {
            CacheEntry     entry      = epCacheEntry.CacheEntry;
            object         lockID     = null;
            LockAccessType lockAccess = LockAccessType.IGNORE_LOCK;

            if (epCacheEntry.LockHandle != null)
            {
                lockAccess = LockAccessType.DEFAULT;
                lockID     = epCacheEntry.LockHandle.LockId;
            }

            OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation);

            operationContext.Add(OperationContextFieldName.RaiseCQNotification, true);

            _cacheRoot.Remove(key, flag, null, lockID, 0, lockAccess, writethruProvider, operationContext);
        }
Ejemplo n.º 15
0
        public static string ToString(LockAccessType accessType)
        {
            switch (accessType)
            {
            case LockAccessType.ACQUIRE:
                return("1");

            case LockAccessType.DONT_ACQUIRE:
                return("2");

            case LockAccessType.RELEASE:
                return("3");

            case LockAccessType.DONT_RELEASE:
                return("4");

            case LockAccessType.IGNORE_LOCK:
                return("5");
            }
            return(string.Empty);
        }
Ejemplo n.º 16
0
        public static string ToString(LockAccessType accessType)
        {
            switch (accessType)
            {
                case LockAccessType.ACQUIRE:
                    return "1";

                case LockAccessType.DONT_ACQUIRE:
                    return "2";

                case LockAccessType.RELEASE:
                    return "3";

                case LockAccessType.DONT_RELEASE:
                    return "4";

                case LockAccessType.IGNORE_LOCK:
                    return "5";
            }
            return string.Empty;
        }
Ejemplo n.º 17
0
        private EPCacheEntry GetEPCacheEntry(Object key, Boolean ignoreLock, OperationContext operationContext)
        {
            Object   lockId   = null;
            ulong    version  = 0;
            DateTime time     = new DateTime(1970, 1, 1, 0, 0, 0, 0);
            DateTime lockDate = time.Date;
            BitSet   flagMap  = new BitSet();

            operationContext.Add(OperationContextFieldName.ReaderBitsetEnum, flagMap);
            operationContext.Add(OperationContextFieldName.DataFormat, DataFormat.Object);
            operationContext.Add(OperationContextFieldName.GenerateQueryInfo, true);

            LockAccessType lockAccessType = LockAccessType.IGNORE_LOCK;

            if (!ignoreLock)
            {
                lockAccessType = LockAccessType.ACQUIRE;
            }

            CacheEntry entry = (CacheEntry)_cacheRoot.GetCacheEntry(key, null, null, ref lockId, ref lockDate, EntryProcessorManager.DefaultLockTimeOut, lockAccessType, operationContext, ref version);

            LockHandle handle = null;

            if (lockId != null)
            {
                handle = new LockHandle(lockId.ToString(), lockDate);
            }

            if (entry != null)
            {
                CallbackEntry callbackEntry = entry.Value as CallbackEntry;
                object        value         = callbackEntry != null ? callbackEntry.Value : entry.Value;
                if (value != null)
                {
                    entry.Value = _context.CachingSubSystemDataService.GetCacheData(value, entry.Flag);
                }
            }

            return(new EPCacheEntry(entry, handle));
        }
Ejemplo n.º 18
0
        public override CacheEntry Get(object key, bool IsUserOperation, ref ulong version, ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType accessType, OperationContext operationContext)
        {
            CacheEntry entry = null;

            base.Sync.AcquireWriterLock(-1);
            try
            {
                entry = this.Internal.Get(key, IsUserOperation, ref version, ref lockId, ref lockDate, lockExpiration, accessType, operationContext);
            }
            finally
            {
                base.Sync.ReleaseWriterLock();
            }
            return(entry);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Function that choose the appropriate function of NCache's Cache, that need to be called
        /// according to the data provided to it.</summary>
        internal virtual void InsertOperation(string key, object value, DateTime absoluteExpiration,
            TimeSpan slidingExpiration, CacheItemPriority priority,
            LockHandle lockHandle, LockAccessType accessType, CacheDataNotificationCallback cacheItemUdpatedCallback,
            CacheDataNotificationCallback cacheItemRemovedCallaback, EventDataFilter itemUpdateDataFilter, EventDataFilter itemRemovedDataFilter, ref long size, bool allowQueryTags)
        {
            if (_cacheImpl == null) throw new OperationFailedException("Cache is not initialized");

            ValidateKeyValue(key, value);
            UsageStats stats = new UsageStats();
            stats.BeginSample();
            Hashtable queryInfo = new Hashtable();
            object lockId = (lockHandle == null) ? null : lockHandle.LockId;

            if (allowQueryTags)
            {
                queryInfo["query-info"] = GetQueryInfo(value);
            }
            short removeCallbackId = -1;
            short updateCallbackId = -1;
            short dsItemUpdateCallbackId = -1;

            BitSet flagMap = new BitSet();
            try
            {
                value = SafeSerialize(value, _serializationContext, ref flagMap, ref size);

                long objectSize = 0;
                if (DebugAPIConfiguraions.LoggingEnabled)
                    objectSize = value is byte[] ? ((byte[])value).Length : 0;
                if (_perfStatsCollector != null && value != null && value is byte[])
                    _perfStatsCollector.IncrementAvgItemSize(((byte[])value).Length);

                if (cacheItemRemovedCallaback != null)
                {
                    short[] callabackIds = _eventManager.RegisterSelectiveEvent(cacheItemRemovedCallaback, EventType.ItemRemoved, itemRemovedDataFilter);
                    removeCallbackId = callabackIds[1];
                }

                if (cacheItemUdpatedCallback != null)
                {
                    short[] callabackIds = _eventManager.RegisterSelectiveEvent(cacheItemUdpatedCallback, EventType.ItemUpdated, itemUpdateDataFilter);
                    updateCallbackId = callabackIds[0];
                }

                if (lockId != null && ((string)lockId) != string.Empty)
                    flagMap.SetBit(BitSetConstants.LockedItem);
                else
                    flagMap.UnsetBit(BitSetConstants.LockedItem);

                absoluteExpiration = ToUTC(absoluteExpiration);

                _cacheImpl.Insert(key, value, absoluteExpiration, slidingExpiration, priority, removeCallbackId, updateCallbackId, queryInfo, flagMap, lockId, accessType, itemUpdateDataFilter, itemRemovedDataFilter, size);

                if (_perfStatsCollector != null)
                {
                    stats.EndSample();
                    _perfStatsCollector.IncrementMsecPerUpdSample(stats.Current);
                    _perfStatsCollector.IncrementUpdPerSecStats();
                }
            }
            catch (Exception)
            {
                if (ExceptionsEnabled) throw;
            }
        }
Ejemplo n.º 20
0
        internal virtual CacheItem GetCacheItemInternal(string key, LockAccessType accessType, TimeSpan lockTimeout, ref LockHandle lockHandle)
        {
            if (_cacheImpl == null) throw new OperationFailedException("Cache is not initialized");

            if (key == null) throw new ArgumentNullException("keys");
            if (key == string.Empty) throw new ArgumentException("key cannot be empty string");
            try
            {
                CacheItem item = new CacheItem();
                Alachisoft.NCache.Caching.CacheEntry entry = null;

                BitSet flagMap = new BitSet();
                object value = _cacheImpl.GetCacheItem(key, flagMap, ref lockHandle, lockTimeout, accessType);

                long objectSize = 0;

                if (value == null) return null;
                if (value is CacheItem)
                {
                    item = (CacheItem)value;
                    if (_perfStatsCollector != null && ((CacheItem)value).Value != null && ((CacheItem)value).Value is byte[])
                        _perfStatsCollector.IncrementAvgItemSize(((byte[])((CacheItem)value).Value).Length);
                    if (DebugAPIConfiguraions.LoggingEnabled)
                        objectSize = ((byte[])item.Value).Length;

                    item.Value = SafeDeserialize(item.Value, _serializationContext, item.FlagMap);
                    if (item.AbsoluteExpiration != Cache.NoAbsoluteExpiration)
                    {
                        item.AbsoluteExpiration = item.AbsoluteExpiration.ToLocalTime();
                    }
                    if (DebugAPIConfiguraions.LoggingEnabled)
                    LogSizeInfo(false, objectSize);

                    return item;
                }

                entry = (Alachisoft.NCache.Caching.CacheEntry)value;
                item.FlagMap = entry.Flag;

                if (entry.Value is CallbackEntry)
                {
                    CallbackEntry cb = (CallbackEntry)entry.Value;
                    if (cb.ItemRemoveCallbackListener != null && cb.ItemRemoveCallbackListener.Count > 0)
                    {
                        foreach (CallbackInfo cbInfo in cb.ItemRemoveCallbackListener)
                        {
                            if (cbInfo.Client == _cacheImpl.ClientID)
                            {
                                item.SetCacheDataNotification((CacheDataNotificationCallback)_callbackIDsMap.GetResource(cbInfo.Callback), EventType.ItemRemoved);
                               break;
                            }
                        }
                    }
                    if (cb.ItemUpdateCallbackListener != null && cb.ItemUpdateCallbackListener.Count > 0)
                    {
                        foreach (CallbackInfo cbInfo in cb.ItemUpdateCallbackListener)
                        {
                            if (cbInfo.Client == _cacheImpl.ClientID)
                            {

                                item.SetCacheDataNotification((CacheDataNotificationCallback)_callbackIDsMap.GetResource(cbInfo.Callback), EventType.ItemUpdated);
                                break;
                            }
                        }
                    }
                    item.Value = cb.Value;
                    if (_perfStatsCollector != null && item.Value != null && item.Value is byte[])
                        _perfStatsCollector.IncrementAvgItemSize(((byte[])item.Value).Length);

                    item.Value = SafeDeserialize(cb.Value, _serializationContext, item.FlagMap);
                }
                else
                {
                    item.Value = entry.Value;
                    if (_perfStatsCollector != null && item.Value != null && item.Value is byte[])
                        _perfStatsCollector.IncrementAvgItemSize(((byte[])item.Value).Length);

                    if (DebugAPIConfiguraions.LoggingEnabled)
                        objectSize = ((byte[])entry.Value).Length;
                    item.Value = SafeDeserialize(entry.Value, _serializationContext, item.FlagMap);
                }
                if (DebugAPIConfiguraions.LoggingEnabled)
                    LogSizeInfo(false, objectSize);
                if (entry != null)
                {
                    item.Priority = (CacheItemPriority)entry.Priority;
                }

                ExpirationHint hint = entry.ExpirationHint;

                DateTime absoluteExpiration = DateTime.MaxValue.ToUniversalTime();
                TimeSpan slidingExpiration = TimeSpan.Zero;

                Alachisoft.NCache.Caching.AutoExpiration.DependencyHelper.GetActualCacheDependency(hint, ref absoluteExpiration, ref slidingExpiration);

                if (absoluteExpiration != Cache.NoAbsoluteExpiration)
                {
                    item.AbsoluteExpiration = absoluteExpiration.ToLocalTime();
                }
                item.SlidingExpiration = slidingExpiration;
                item._creationTime = entry.CreationTime;
                item._lastModifiedTime = entry.LastModifiedTime;
                return item;

            }
            catch (Exception)
            {
                if (ExceptionsEnabled) throw;
            }
            return null;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Remove the object from the cluster. 
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <returns>cache entry.</returns>
        /// <remarks>
        /// This method invokes <see cref="handleRemove"/> on every server node in the cluster.
        /// </remarks>
        protected CacheEntry Clustered_Remove(object key, ItemRemoveReason ir, CallbackEntry cbEntry,   bool notify, object lockId,  LockAccessType accessType, OperationContext operationContext)
        {
            CacheEntry retVal = null;
            try
            {
                if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCacheBase.Remove", "enter");
                Function func = new Function((int)OpCodes.Remove, new object[] { key, ir, notify, cbEntry,  lockId, accessType,  operationContext }, false, key);
                RspList results = Cluster.BroadcastToServers(func, GroupRequest.GET_ALL, _asyncOperation);
                if (results == null)
                {
                    return retVal;
                }

                ClusterHelper.ValidateResponses(results, typeof(OperationResponse), Name);

                Rsp rsp = ClusterHelper.FindAtomicRemoveStatusReplicated(results);
                if (rsp == null)
                {
                    return retVal;
                }

                OperationResponse opRes = rsp.Value as OperationResponse;
                if (opRes != null)
                {
                    CacheEntry entry = opRes.SerializablePayload as CacheEntry;
                    if (entry != null)
                        entry.Value = opRes.UserPayload;
                    return entry;
                }
            }
            catch (CacheException e)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new GeneralFailureException(e.Message, e);
            }
            finally
            {
                if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCacheBase.Remove", "exit");
            }
            return retVal;
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Retrieve the object from the cluster. 
 /// </summary>
 /// <param name="key">key of the entry.</param>
 /// <param name="excludeSelf">Set false to do a complete cluster lookup.</param>
 /// <returns>cache entry.</returns>
 protected CacheEntry Clustered_Get(Address address, object key, ref object lockId, ref DateTime lockDate, LockAccessType accessType, OperationContext operationContext)
 {
     CacheEntry retVal = null;
     try
     {
         if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCacheBase.Get", "enter");
         Function func = new Function((int)OpCodes.Get, new object[] { key, operationContext });
         object result = Cluster.SendMessage(address, func, GroupRequest.GET_FIRST, false);
         if (result == null)
         {
             return retVal;
         }
         retVal = (CacheEntry)((OperationResponse)result).SerializablePayload;
         if (retVal != null) retVal.Value = ((OperationResponse)result).UserPayload;
     }
     catch (CacheException e)
     {
         throw;
     }
     catch (Exception e)
     {
         throw new GeneralFailureException(e.Message, e);
     }
     finally
     {
         if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCacheBase.Get", "exit");
     }
     return retVal;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Retrieve the object from the cluster. 
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <param name="excludeSelf">Set false to do a complete cluster lookup.</param>
        /// <returns>cache entry.</returns>
        protected CacheEntry Clustered_Get(Address address, object key, ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType access, OperationContext operationContext)
        {
            if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("ClustCacheBase.Get", "");

            CacheEntry retVal = null;
            try
            {
                Function func = new Function((int)OpCodes.Get, new object[] { key, lockId, lockDate, access, lockExpiration, operationContext });
                object result = Cluster.SendMessage(address, func, GetFirstResponse);
                if (result == null)
                {
                    return retVal;
                }

                object[] objArr = (object[])((OperationResponse)result).SerializablePayload;
                retVal = objArr[0] as CacheEntry;
                if (retVal != null)
                {
                    retVal.Value = ((OperationResponse)result).UserPayload;
                }
                lockId = objArr[1];
                lockDate = (DateTime)objArr[2];
            }
            catch (Runtime.Exceptions.TimeoutException te)
            {
                throw;
            }
            catch (Runtime.Exceptions.SuspectedException se)
            {
                throw;
            }
            catch (CacheException e)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new GeneralFailureException(e.Message, e);
            }
            return retVal;
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Add the object to the cluster. 
 /// </summary>
 /// <param name="key"></param>
 /// <param name="cacheEntry"></param>
 /// <returns></returns>
 /// <remarks>
 /// This method invokes <see cref="handleInsert"/> on every server-node in the cluster. If 
 /// the operation fails on any one node the whole operation is considered to have failed 
 /// and is rolled-back.
 /// </remarks>
 private CacheInsResultWithEntry Clustered_Insert(object key, CacheEntry cacheEntry, object lockId, LockAccessType accesssType, OperationContext operationContext)
 {
     return Clustered_Insert(Cluster.Servers, key, cacheEntry, lockId, accesssType, operationContext);
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Removes the object and key pair from the cache. The key is specified as parameter.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <returns>cache entry.</returns>
        /// <remarks>
        /// Remove notifications in a repicated cluster are handled differently. If there is an 
        /// explicit request for Remove, the node initiating the request triggers the notifications.
        /// Expirations and Evictions are replicated and again the node initiating the replication
        /// triggers the cluster-wide notification.
        /// </remarks>
        public override CacheEntry Remove(object key, ItemRemoveReason ir, bool notify, object lockId,  LockAccessType accessType, OperationContext operationContext)
        {
            if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCache.Remove", "");
            /// Wait until the object enters any running status
            _statusLatch.WaitForAny(NodeStatus.Initializing | NodeStatus.Running);

            if (_internalCache == null) throw new InvalidOperationException();

            object actualKey = key;
            CallbackEntry cbEntry = null;
           
            if (key is object[])
            {
                object[] package = key as object[];
                actualKey = package[0];
                cbEntry = package[2] as CallbackEntry;
            }

            CacheEntry e = null;

            if (accessType != LockAccessType.IGNORE_LOCK)
            {
                //Get internally catters for the state-transfer scenarios.
                e = Get(key, operationContext);
                if (e != null)
                {
                    if (e.IsItemLocked() && !e.CompareLock(lockId))
                    {
                        //this exception directly goes to user. 
                        throw new LockingException("Item is locked.");
                    }
                }
            }       
            try
            {
                if (Cluster.Servers.Count > 1)
                    e = Clustered_Remove(actualKey, ir, cbEntry, false, lockId, accessType, operationContext);
                else
                    e = Local_Remove(actualKey, ir, Cluster.LocalAddress, cbEntry,  true, lockId, accessType, operationContext);
            }
            catch (Runtime.Exceptions.TimeoutException)
            {
                Thread.Sleep(2000);

                if (Cluster.Servers.Count > 1)
                    e = Clustered_Remove(actualKey, ir, cbEntry,  false, lockId,  accessType, operationContext);
                else
                    e = Local_Remove(actualKey, ir, Cluster.LocalAddress, cbEntry,  true, lockId, accessType, operationContext);
            }
          
            if (e != null && notify)
            {
           
                RemoveUpdateIndexOperation(key);
            }

           return e;
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Adds a pair of key and value to the cache. If the specified key already exists 
        /// in the cache; it is updated, otherwise a new item is added to the cache.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <param name="cacheEntry">the cache entry.</param>
        /// <returns>returns the result of operation.</returns>
        /// <remarks>
        /// This method invokes <see cref="handleInsert"/> on every server-node in the cluster. If the operation
        /// fails on any one node the whole operation is considered to have failed and is rolled-back.
        /// Moreover the node initiating this request (this method) also triggers a cluster-wide 
        /// item-update notificaion.
        /// </remarks>
        public override CacheInsResultWithEntry Insert(object key, CacheEntry cacheEntry, bool notify, object lockId,  LockAccessType accessType, OperationContext operationContext)
        {
            if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCache.Insert", "");
            /// Wait until the object enters any running status
            _statusLatch.WaitForAny(NodeStatus.Initializing | NodeStatus.Running);

            if (_internalCache == null) throw new InvalidOperationException();

            if (Context.NCacheLog.IsInfoEnabled) Context.NCacheLog.Info("Replicated.Insert()", "Key = " + key);

            CacheEntry pEntry = null;
            CacheInsResultWithEntry retVal = new CacheInsResultWithEntry();
            Exception thrown = null;

            try
            {
                // We get the actual item to raise custom call back with the item.
                //Get internally catters for the state-transfer scenarios. 
                pEntry = Get(key, operationContext);
                retVal.Entry = pEntry;

                if (pEntry != null)
                {
                    if (accessType != LockAccessType.IGNORE_LOCK)
                    {
                        if (pEntry.IsItemLocked() && !pEntry.CompareLock(lockId))
                        {
                            //throw new LockingException("Item is locked.");
                            retVal.Entry = null;
                            retVal.Result = CacheInsResult.ItemLocked;
                            return retVal;
                        }
                    }
                }
                if (Cluster.Servers.Count > 1)
                {
                    // Try to add to the local node and the cluster.
                    retVal = Clustered_Insert(key, cacheEntry, lockId, accessType, operationContext);

                    //muds:
                    //if coordinator has sent the previous entry, use that one...
                    //otherwise send back the localy got previous entry...
                    if (retVal.Entry != null)
                        pEntry = retVal.Entry;
                    else
                        retVal.Entry = pEntry;
                }
                else
                    retVal = Local_Insert(key, cacheEntry, Cluster.LocalAddress,  true, lockId,  accessType, operationContext);
            }
            catch (Exception e)
            {
                thrown = e;
            }

            // Try to insert to the local node and the cluster.
            if ((retVal.Result == CacheInsResult.NeedsEviction || retVal.Result == CacheInsResult.Failure || retVal.Result == CacheInsResult.FullTimeout || retVal.Result == CacheInsResult.PartialTimeout) || thrown != null)
            {
                Context.NCacheLog.Warn("Replicated.Insert()", "rolling back, since result was " + retVal.Result);
                bool rollback = true;
                bool timeout = false;
                if (retVal.Result == CacheInsResult.PartialTimeout)
                {
                    timeout = true;
                }
                else if (retVal.Result == CacheInsResult.FullTimeout)
                {
                    timeout = true;
                    rollback = false;
                }

                if (rollback)
                {
                    Thread.Sleep(2000);
                    /// failed on the cluster, so remove locally as well.
                    if (Cluster.Servers.Count > 1)
                    {
                        Clustered_Remove(key, ItemRemoveReason.Removed, null, false, null,  LockAccessType.IGNORE_LOCK, operationContext);
                    }
                }
                if (timeout)
                {
                    throw new Runtime.Exceptions.TimeoutException("Operation timeout.");

                }
                if (thrown != null) throw thrown;
            }
            if (notify && retVal.Result == CacheInsResult.SuccessOverwrite)
            {
                 RemoveUpdateIndexOperation(key);
            }

          return retVal;
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Adds a pair of key and value to the cache. If the specified key already exists 
 /// in the cache; it is updated, otherwise a new item is added to the cache.
 /// </summary>
 /// <param name="key">key of the entry.</param>
 /// <returns>cache entry.</returns>
 /// <remarks>
 /// Does an Insert locally, however the generated notification is discarded, since it is 
 /// specially handled in <see cref="Insert"/>.
 /// </remarks>
 private CacheInsResultWithEntry Local_Insert(object key, CacheEntry cacheEntry, Address src,  bool notify, object lockId,  LockAccessType accessType, OperationContext operationContext)
 {
     CacheInsResultWithEntry retVal = new CacheInsResultWithEntry();
     try
     {
         if (_internalCache != null)
         {
             retVal = _internalCache.Insert(key, cacheEntry, notify, lockId,accessType, operationContext);
         }
     }
     catch (Exception e)
     {
         if (_clusteredExceptions) throw;
     }
     return retVal;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Retrieve the object from the local cache only. 
 /// </summary>
 /// <param name="key">key of the entry.</param>
 /// <returns>cache entry.</returns>
 private CacheEntry Local_Get(object key,  ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType access, OperationContext operationContext)
 {
     CacheEntry retVal = null;
     if (_internalCache != null)
         retVal = _internalCache.Get(key, ref lockId, ref lockDate, lockExpiration, access, operationContext);
     return retVal;
 }
Ejemplo n.º 29
0
        private CacheEntry Safe_Clustered_Get(object key, ref object lockId, ref DateTime lockDate, LockAccessType accessType, OperationContext operationContext)
        {
            try
            {
                return Clustered_Get(key, ref lockId, ref lockDate, accessType, operationContext);
            }
            catch (Alachisoft.NGroups.SuspectedException e)
            {
                return Clustered_Get(key, ref lockId, ref lockDate, accessType, operationContext);
            }
            catch (Runtime.Exceptions.TimeoutException e)
            {
                return Clustered_Get(key, ref lockId, ref lockDate, accessType, operationContext);
            }

        }
Ejemplo n.º 30
0
 /// <summary>
 /// Retrieve the object from the cluster. Used during state trasfer, when the cache
 /// is loading state from other members of the cluster.
 /// </summary>
 /// <param name="key">key of the entry.</param>
 private CacheEntry Clustered_Get(object key, ref object lockId, ref DateTime lockDate, LockAccessType accessType, OperationContext operationContext)
 {
     /// Fetch address of a fully functional node. There should always be one
     /// fully functional node in the cluster (coordinator is alway fully-functional).
     Address targetNode = GetNextNode();
     if (targetNode != null)
         return Clustered_Get(targetNode, key, ref lockId, ref lockDate, accessType, operationContext);
     return null;
 }
Ejemplo n.º 31
0
 public override CacheInsResultWithEntry Insert(object key, CacheEntry cacheEntry, bool notify, object lockId, ulong version, LockAccessType accessType, OperationContext operationContext)
 {
     return(this.Insert(key, cacheEntry, notify, (string)null, lockId, version, accessType, operationContext));
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Remove the object from the local cache only. 
 /// </summary>
 /// <param name="key">key of the entry.</param>
 /// <param name="ir"></param>
 /// <param name="notify"></param>
 /// <returns>cache entry.</returns>
 private CacheEntry Local_Remove(object key, ItemRemoveReason ir, Address src, CallbackEntry cbEntry, bool notify, object lockId,  LockAccessType accessType, OperationContext operationContext)
 {
     CacheEntry retVal = null;
     if (_internalCache != null)
     {
         retVal = _internalCache.Remove(key, ir, notify, lockId,  accessType, operationContext);
     }
     return retVal;
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Remove a entrada associada com a chave informada.
 /// </summary>
 /// <param name="key">Chave da entrada que será apagada.</param>
 /// <param name="ir"></param>
 /// <param name="notify"></param>
 /// <param name="lockId"></param>
 /// <param name="version"></param>
 /// <param name="accessType"></param>
 /// <param name="operationContext"></param>
 /// <returns></returns>
 public override CacheEntry Remove(object key, ItemRemoveReason ir, bool notify, object lockId, ulong version, LockAccessType accessType, OperationContext operationContext)
 {
     return(this.Remove(key, ir, notify, (string)null, lockId, version, accessType, operationContext));
 }
Ejemplo n.º 34
0
        /// <summary>
        /// Removes the object and key pair from the cache. The key is specified as parameter.
        /// Moreover it take a removal reason and a boolean specifying if a notification should
        /// be raised.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <param name="ir"></param>
        /// <param name="notify">boolean specifying to raise the event.</param>
        /// <param name="lockId"></param>
        /// <param name="accessType"></param>
        /// <param name="operationContext"></param>
        /// <param name="removalReason">reason for the removal.</param>
        /// <returns>item value</returns>
        public override CacheEntry Remove(object key, ItemRemoveReason ir, bool notify, object lockId, LockAccessType accessType, OperationContext operationContext)
        {
            CacheEntry retVal = Internal.Remove(key, ir, notify, lockId, accessType, operationContext);

            return(retVal);
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Retrieve the object from the cache. A string key is passed as parameter.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <returns>cache entry.</returns>
        public override CacheEntry Get(object key, ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType access, OperationContext operationContext)
        {
            if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCache.Get", "");
            /// Wait until the object enters any running status
            _statusLatch.WaitForAny(NodeStatus.Initializing | NodeStatus.Running);

            if (_internalCache == null) throw new InvalidOperationException();
            CacheEntry e = null;

           
            if (access == LockAccessType.ACQUIRE || access == LockAccessType.DONT_ACQUIRE)
            {
                if (Cluster.Servers.Count > 1)
                {
                    e = Local_Get(key, false, operationContext);
                    if (e != null)
                    {
                        if (access == LockAccessType.DONT_ACQUIRE)
                        {
                            if (e.IsItemLocked() && !e.CompareLock(lockId))
                            {
                                lockId = e.LockId;
                                lockDate = e.LockDate;
                                e = null;
                            }
                            else
                            {
                                lockDate = e.LockDate; //compare lock does not set the lockdate internally.
                            }
                        }
                        else if (!e.IsLocked(ref lockId, ref lockDate))
                        {
                            if (Clustered_Lock(key, lockExpiration, ref lockId, ref lockDate, operationContext))
                            {
                                e = Local_Get(key,  ref lockId, ref lockDate, lockExpiration, LockAccessType.IGNORE_LOCK, operationContext);
                            }
                        }
                        else
                        {
                            //dont send the entry back if it is locked.
                            e = null;
                        }
                    }
                    else if (_statusLatch.IsAnyBitsSet(NodeStatus.Initializing))
                    {
                        if (access == LockAccessType.ACQUIRE)
                        {
                            if (Clustered_Lock(key, lockExpiration, ref lockId, ref lockDate, operationContext))
                            {
                                e = Clustered_Get(key, ref lockId, ref lockDate, access, operationContext);
                            }
                        }
                        else
                        {
                            e = Clustered_Get(key, ref lockId, ref lockDate, access, operationContext);
                        }
                    }
                }
                else
                {
                    e = Local_Get(key,  ref lockId, ref lockDate, lockExpiration, access, operationContext);
                }
            }
            else
            {
                e = Local_Get(key, operationContext);

                if (e == null && _statusLatch.IsAnyBitsSet(NodeStatus.Initializing))
                {
                    e = Clustered_Get(key, ref lockId, ref lockDate, LockAccessType.IGNORE_LOCK, operationContext);
                }
            }

            if (e == null)
            {
                _stats.BumpMissCount();
            }
            else
            {
                _stats.BumpHitCount();
                // update the indexes on other nodes in the cluster
                if ((e.ExpirationHint != null && e.ExpirationHint.IsVariant) /*|| (e.EvictionHint !=null && e.EvictionHint.IsVariant)*/ )
                {
                    UpdateIndices(key, true, operationContext);
                    Local_Get(key, operationContext); //to update the index locally.
                }
            }
            return e;
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Retrieve the object from the cache. A string key is passed as parameter.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <param name="isUserOperation"></param>
        /// <param name="lockId"></param>
        /// <param name="lockDate"></param>
        /// <param name="lockExpiration"></param>
        /// <param name="accessType"></param>
        /// <param name="operationContext"></param>
        /// <returns>cache entry.</returns>
        public sealed override CacheEntry Get(object key, bool isUserOperation, ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType accessType, OperationContext operationContext)
        {
            CacheEntry e = GetInternal(key, isUserOperation, operationContext);

            if (accessType != LockAccessType.IGNORE_LOCK)
            {
                if (e != null)
                {
                    if (accessType == LockAccessType.DONT_ACQUIRE)
                    {
                        bool success = e.CompareLock(lockId);
                        if (success)
                        {
                            //explicitly set the lockdate incase of compare lock.
                            //compare lock does not set the lockdate.
                            lockDate = e.LockDate;
                        }
                        else
                        {
                            success = !e.IsLocked(ref lockId, ref lockDate);
                        }

                        if (!success) { e = null; }


                    }
                    else if (accessType == LockAccessType.ACQUIRE && !e.Lock(lockExpiration, ref lockId, ref lockDate))//internally sets the out parameters
                    {
                        e = null;
                    }
                }
                else
                {
                    lockId = null;
                }
            }

            ExpirationHint exh = (e == null ? null : e.ExpirationHint);
            if (exh != null)
            {
                if (exh.CheckExpired(_context))
                {
                    // If cache forward is set we skip the expiration.
                    if (!exh.NeedsReSync)
                    {

                        ItemRemoveReason reason = ItemRemoveReason.Expired;
                        
                        Remove(key, reason, true, null, LockAccessType.IGNORE_LOCK, operationContext);

                        e = null;
                    }
                }

                if (exh.IsVariant && isUserOperation)
                {
                    try
                    {
                        _context.ExpiryMgr.ResetVariant(exh);
                    }
                    catch (Exception ex)
                    {
                        RemoveInternal(key, ItemRemoveReason.Removed, false, operationContext);
                        throw ex;
                    }
                }
            }

            _stats.UpdateCount(this.Count);
            if (e != null)
                _stats.BumpHitCount();
            else
                _stats.BumpMissCount();

            return e;
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Updates or Adds the object to the cluster.
        /// </summary>
        /// <param name="dest"></param>
        /// <param name="key">key of the entry.</param>
        /// <param name="cacheEntry"></param>
        /// <param name="lockId"></param>
        /// <param name="accessType"></param>
        /// <param name="operationContext"></param>
        /// <returns>cache entry.</returns>
        /// <remarks>
        /// This method invokes <see cref="handleInsert"/> on the specified node.
        /// </remarks>
        protected CacheInsResultWithEntry Clustered_Insert(Address dest, object key, CacheEntry cacheEntry, object lockId, LockAccessType accessType, OperationContext operationContext)
        {
            if (ServerMonitor.MonitorActivity)
            {
                ServerMonitor.LogClientActivity("PartCacheBase.Insert", "");
            }

            CacheInsResultWithEntry retVal = new CacheInsResultWithEntry();

            try
            {
                Function func        = new Function((int)OpCodes.Insert, new object[] { key, cacheEntry.CloneWithoutValue(), lockId, accessType, operationContext });
                Array    userPayLoad = null;
                if (cacheEntry.Value is CallbackEntry)
                {
                    CallbackEntry cbEntry = ((CallbackEntry)cacheEntry.Value);
                    userPayLoad = cbEntry.UserData;
                }
                else
                {
                    userPayLoad = cacheEntry.UserData;
                }

                func.UserPayload      = userPayLoad;
                func.ResponseExpected = true;
                object result = Cluster.SendMessage(dest, func, GroupRequest.GET_FIRST, false);
                if (result == null)
                {
                    return(retVal);
                }

                retVal = (CacheInsResultWithEntry)((OperationResponse)result).SerializablePayload;
                if (retVal.Entry != null)
                {
                    retVal.Entry.Value = ((OperationResponse)result).UserPayload;
                }
            }
            catch (Runtime.Exceptions.SuspectedException se)
            {
                throw;
            }
            catch (Runtime.Exceptions.TimeoutException te)
            {
                throw;
            }
            catch (CacheException e)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new GeneralFailureException(e.Message, e);
            }
            return(retVal);
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Adds a pair of key and value to the cache. If the specified key already exists 
        /// in the cache; it is updated, otherwise a new item is added to the cache.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <param name="cacheEntry">the cache entry.</param>
        /// <returns>returns the result of operation.</returns>
        public sealed override CacheInsResultWithEntry Insert(object key, CacheEntry cacheEntry, bool notify, bool isUserOperation, object lockId, LockAccessType access, OperationContext operationContext)
        {
            CacheInsResultWithEntry result = new CacheInsResultWithEntry();
            try
            {
                CacheEntry pe = null;
                CallbackEntry cbEtnry = null;
                OperationID opId = operationContext.OperatoinID;
                EventId eventId = null;
                EventContext eventContext = null;
                
                pe = GetInternal(key, false, operationContext);
                result.Entry = pe;

                if (pe != null && access != LockAccessType.IGNORE_LOCK)
                {
                    {
                        if (access == LockAccessType.RELEASE || access == LockAccessType.DONT_RELEASE)
                        {
                            if (pe.IsItemLocked() && !pe.CompareLock(lockId))
                            {
                                result.Result = CacheInsResult.ItemLocked;
                                result.Entry = null;
                                return result;
                            }
                        }
                        if (access == LockAccessType.DONT_RELEASE)
                        {
                            cacheEntry.CopyLock(pe.LockId, pe.LockDate, pe.LockExpiration);
                        }
                        else
                        {
                            cacheEntry.ReleaseLock();
                        }
                    }
                }
                ExpirationHint peExh = pe == null ? null : pe.ExpirationHint;

                if (pe != null && pe.Value is CallbackEntry)
                {
                    cbEtnry = pe.Value as CallbackEntry;
                    cacheEntry = CacheHelper.MergeEntries(pe, cacheEntry);
                }
                result.Result = InsertInternal(key, cacheEntry, isUserOperation, pe, operationContext);

                if ((result.Result == CacheInsResult.Success || result.Result == CacheInsResult.SuccessNearEvicition) && _stateTransferKeyList != null &&
                    _stateTransferKeyList.ContainsKey(key))
                {
                    result.Result = result.Result == CacheInsResult.Success ? CacheInsResult.SuccessOverwrite : CacheInsResult.SuccessOverwriteNearEviction;
                }
                // Not enough space, evict and try again.
                if (result.Result == CacheInsResult.NeedsEviction || result.Result == CacheInsResult.SuccessNearEvicition
                    || result.Result == CacheInsResult.SuccessOverwriteNearEviction)
                {
                    Evict();
                    if (result.Result == CacheInsResult.SuccessNearEvicition) result.Result = CacheInsResult.Success;
                    if (result.Result == CacheInsResult.SuccessOverwriteNearEviction) result.Result = CacheInsResult.SuccessOverwrite;
                }

                // Operation completed!
                if (result.Result == CacheInsResult.Success || result.Result == CacheInsResult.SuccessOverwrite)
                {
                    // commented by muds
                    //remove the old hint from expiry index.
                    if (peExh != null)
                        _context.ExpiryMgr.RemoveFromIndex(key);

                    if (cacheEntry.ExpirationHint != null)
                    {
                        cacheEntry.ExpirationHint.CacheKey = (string)key;
                        if (isUserOperation)
                        {
                            try
                            {
                                _context.ExpiryMgr.ResetHint(peExh, cacheEntry.ExpirationHint);
                            }
                            catch (Exception e)
                            {
                                RemoveInternal(key, ItemRemoveReason.Removed, false, operationContext);
                                throw e;
                            }
                        }
                        else
                        {
                            cacheEntry.ExpirationHint.ReInitializeHint(Context);
                        }

                        _context.ExpiryMgr.UpdateIndex(key, cacheEntry);
                    }
                    if (IsSelfInternal)
                    {
                        _context.PerfStatsColl.IncrementCountStats((long)Count);
                    }
                }

                _stats.UpdateCount(this.Count);
                switch (result.Result)
                {
                    case CacheInsResult.Success:
                        break;
                    case CacheInsResult.SuccessOverwrite:
                        if (notify)
                        {
                            EventCacheEntry eventCacheEntry = CacheHelper.CreateCacheEventEntry(Runtime.Events.EventDataFilter.DataWithMetadata, cacheEntry); ;
                            EventCacheEntry oldEventCacheEntry = CacheHelper.CreateCacheEventEntry(Runtime.Events.EventDataFilter.DataWithMetadata, pe);

                            if (cbEtnry != null)
                            {
                                if (cbEtnry.ItemUpdateCallbackListener != null && cbEtnry.ItemUpdateCallbackListener.Count > 0)
                                {
                                    if (!operationContext.Contains(OperationContextFieldName.EventContext)) //for atomic operations
                                    {
                                        eventId = EventId.CreateEventId(opId);
                                        eventContext = new EventContext();
                                    }
                                    else //for bulk
                                    {
                                        eventId = ((EventContext)operationContext.GetValueByField(OperationContextFieldName.EventContext)).EventID;
                                    }

                                    eventContext = new EventContext();
                                    eventId.EventType = EventType.ITEM_UPDATED_CALLBACK;
                                    eventContext.Add(EventContextFieldName.EventID, eventId);
                                    eventContext.Item = eventCacheEntry;
                                    eventContext.OldItem = oldEventCacheEntry;

                                    NotifyCustomUpdateCallback(key, cbEtnry.ItemUpdateCallbackListener, false, (OperationContext)operationContext.Clone(), eventContext);
                                }
                            }
                        }
                        break;
                }
            }
            finally
            {
            }

           if (_context.PerfStatsColl != null)
            {
                _context.PerfStatsColl.SetCacheSize(Size);
            }


            return result;
        }
Ejemplo n.º 39
0
        protected CacheInsResultWithEntry Clustered_Insert(ArrayList dests, object key, CacheEntry cacheEntry,  object lockId, LockAccessType accessType, OperationContext operationContext)
        {
            try
            {
                if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCacheBase.Insert", "enter");
             

                /// Ask every server to update the object, except myself.
                Function func = new Function((int)OpCodes.Insert, new object[] { key, cacheEntry, _statusLatch.IsAnyBitsSet(NodeStatus.Initializing), lockId, accessType, operationContext }, false, key);
                Array userPayLoad = null;
                if (cacheEntry.Value is CallbackEntry)
                {
                    CallbackEntry cbEntry = ((CallbackEntry)cacheEntry.Value);
                    userPayLoad = cbEntry.UserData;
                }
                else
                {
                    userPayLoad = cacheEntry.UserData;
                }

                func.UserPayload = userPayLoad;
                RspList results = Cluster.BroadcastToMultiple(dests,
                    func,
                    GroupRequest.GET_ALL, _asyncOperation);

                ClusterHelper.ValidateResponses(results, typeof(OperationResponse), Name);

                //Bug Fixed, during state transfer (one node up with the exisiting one) of replicated cache, 
                //while client doing insert operaion continously, which incrementing the add/sec counter while the client only performing insert
                //means no need to incrment add/sec counter, need only updat/sec to be incremented
                //so after discussing with QA, we modify the code here.
                CacheInsResultWithEntry retVal = ClusterHelper.FindAtomicInsertStatusReplicated(results);
                if (retVal != null && retVal.Result == CacheInsResult.Success && results != null)
                {
                    for (int i = 0; i < results.Results.Count; i++)
                    {
                        if (((CacheInsResultWithEntry)((OperationResponse)results.Results[i]).SerializablePayload).Result == CacheInsResult.SuccessOverwrite)
                        {
                            retVal.Result = CacheInsResult.SuccessOverwrite;
                            break;
                        }
                    }
                }
                return retVal;

            }
            catch (CacheException e)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new GeneralFailureException(e.Message, e);
            }
            finally
            {
                if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RepCacheBase.Insert", "exit");
            }
        }
Ejemplo n.º 40
0
        /// <summary>
        /// Removes the object and key pair from the cache. The key is specified as parameter.
        /// Moreover it take a removal reason and a boolean specifying if a notification should
        /// be raised.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <param name="removalReason">reason for the removal.</param>
        /// <param name="notify">boolean specifying to raise the event.</param>
        /// <param name="isUserOperation"></param>
        /// <param name="lockId"></param>
        /// <param name="accessType"></param>
        /// <param name="operationContext"></param>
        /// <returns>item value</returns>
        public override CacheEntry Remove(object key, ItemRemoveReason removalReason, bool notify, bool isUserOperation, object lockId, LockAccessType accessType, OperationContext operationContext)
        {
            CacheEntry e = null;
            CacheEntry pe = null;
            {
                object actualKey = key;
                if (key is object[])
                {
                    actualKey = ((object[])key)[0];
                }

                if (accessType != LockAccessType.IGNORE_LOCK)
                {
                    pe = GetInternal(actualKey, false, operationContext);
                    if (pe != null)
                    {
                        if (pe.IsItemLocked() && !pe.CompareLock(lockId))
                        {
                            throw new LockingException("Item is locked.");
                        }
                    }
                }



                e = RemoveInternal(actualKey, removalReason, isUserOperation, operationContext);
                EventId eventId = null;
                EventContext eventContext = null;
                OperationID opId = operationContext.OperatoinID;
                if (e != null)
                {
                    if (_stateTransferKeyList != null && _stateTransferKeyList.ContainsKey(key))
                        _stateTransferKeyList.Remove(key);
                    // commented by muds
                    try
                    {
                        if (e.ExpirationHint != null)
                        {
                            _context.ExpiryMgr.RemoveFromIndex(key);
                            ((IDisposable)e.ExpirationHint).Dispose();
                        }
                    }
                    catch (Exception ex)
                    {
                        NCacheLog.Error("LocalCacheBase.Remove(object, ItemRemovedReason, bool):", ex.ToString());
                    }

                    if (IsSelfInternal)
                    {
                        // Disposed the one and only cache entry.
                        ((IDisposable)e).Dispose();

                        if (removalReason == ItemRemoveReason.Expired)
                        {
                            _context.PerfStatsColl.IncrementExpiryPerSecStats();
                        }
                        else if (!_context.CacheImpl.IsEvictionAllowed && removalReason == ItemRemoveReason.Underused)
                        {
                            _context.PerfStatsColl.IncrementEvictPerSecStats();
                        }
                        _context.PerfStatsColl.IncrementCountStats((long)Count);
                    }
                    if (notify)
                    {
                        CallbackEntry cbEtnry = e.Value as CallbackEntry;// e.DeflattedValue(_context.SerializationContext);
                        
                        if (cbEtnry != null && cbEtnry.ItemRemoveCallbackListener != null && cbEtnry.ItemRemoveCallbackListener.Count > 0)
                        {
                            //generate event id
                            if (!operationContext.Contains(OperationContextFieldName.EventContext)) //for atomic operations
                            {
                                eventId = EventId.CreateEventId(opId);
                            }
                            else //for bulk
                            {
                                eventId = ((EventContext)operationContext.GetValueByField(OperationContextFieldName.EventContext)).EventID;
                            }

                            eventId.EventType = EventType.ITEM_REMOVED_CALLBACK;
                            eventContext = new EventContext();
                            eventContext.Add(EventContextFieldName.EventID, eventId);
                            EventCacheEntry eventCacheEntry = CacheHelper.CreateCacheEventEntry(cbEtnry.ItemRemoveCallbackListener, e);
                            eventContext.Item = eventCacheEntry;
                            eventContext.Add(EventContextFieldName.ItemRemoveCallbackList, cbEtnry.ItemRemoveCallbackListener.Clone());
                            
                            //Will always reaise the whole entry for old clients
                            NotifyCustomRemoveCallback(actualKey, e, removalReason, false, (OperationContext)operationContext.Clone(), eventContext);
                        }
                    }

                   

                }
                else if (_stateTransferKeyList != null && _stateTransferKeyList.ContainsKey(key))
                {
                    _stateTransferKeyList.Remove(key);        
                }

            }
            _stats.UpdateCount(this.Count);

            if (_context.PerfStatsColl != null)
            {
                _context.PerfStatsColl.SetCacheSize(Size);
            }

            return e;
        }
Ejemplo n.º 41
0
        internal virtual void Delete(string key, LockHandle lockHandle,  LockAccessType accessType)
        {
            if (_cacheImpl == null) throw new OperationFailedException("Cache is not initialized");

            if (key == null) throw new ArgumentNullException("key");
            if (key == string.Empty) throw new ArgumentException("key cannot be empty string");
            try
            {
                UsageStats stats = new UsageStats();
                stats.BeginSample();
                object lockId = (lockHandle == null) ? null : lockHandle.LockId;
                BitSet flagMap = new BitSet();

                _cacheImpl.Delete(key, flagMap, lockId, accessType);
            }
            catch (Exception)
            {
                if (ExceptionsEnabled) throw;
            }
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Adds a pair of key and value to the cache. If the specified key already exists
        /// in the cache; it is updated, otherwise a new item is added to the cache.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <param name="cacheEntry">the cache entry.</param>
        /// <returns>returns the result of operation.</returns>
        public override CacheInsResultWithEntry Insert(object key, CacheEntry cacheEntry, bool notify, object lockId, LockAccessType accessType, OperationContext operationContext)
        {
            CacheInsResultWithEntry retVal = new CacheInsResultWithEntry();

            if (Internal != null)
            {
                retVal = Internal.Insert(key, cacheEntry, notify, lockId, accessType, operationContext);
            }
            return(retVal);
        }
Ejemplo n.º 43
0
        internal virtual object GetInternal(string key,  LockAccessType accessType, TimeSpan lockTimeout, ref LockHandle lockHandle)
        {
            if (_cacheImpl == null) throw new OperationFailedException("Cache is not initialized");

            if (key == null) throw new ArgumentNullException("key");
            if (key == string.Empty) throw new ArgumentException("key cannot be empty string");
            long objectSize = 0;

            CompressedValueEntry result = null;
            try
            {
                BitSet flagMap = new BitSet();
                UsageStats stats = new UsageStats();
                stats.BeginSample();
                result = _cacheImpl.Get(key, flagMap, ref lockHandle, lockTimeout, accessType);
                if (_perfStatsCollector != null)
                {
                    stats.EndSample();
                    _perfStatsCollector.IncrementMsecPerGetSample(stats.Current);
                    _perfStatsCollector.IncrementGetPerSecStats();
                }
                if (result != null && result.Value != null)
                {
                    if (result.Value is CallbackEntry)
                    {
                        CallbackEntry e = result.Value as CallbackEntry;
                        result.Value = e.Value;
                    }
                    if (DebugAPIConfiguraions.LoggingEnabled)
                        objectSize = result.Value is byte[] ? ((byte[])result.Value).Length : 0;

                    result.Value = SafeDeserialize(result.Value, _serializationContext, result.Flag);
                    if (DebugAPIConfiguraions.LoggingEnabled)
                        LogSizeInfo(false, objectSize);
                    return result.Value;
                }
            }
            catch (Exception)
            {
                if (ExceptionsEnabled) throw;
                else return null;
            }
            return null;
        }
Ejemplo n.º 44
0
 public virtual CompressedValueEntry Remove <T>(string key, BitSet flagMap, short dsItemRemovedCallbackId, object lockId, LockAccessType accessType, string ProviderName)
 {
     return(null);
 }
Ejemplo n.º 45
0
        internal virtual object Remove(string key, LockHandle lockHandle, LockAccessType accessType)
        {
            if (_cacheImpl == null) throw new OperationFailedException("Cache is not initialized");

            if (key == null) throw new ArgumentNullException("key");
            if (key == string.Empty) throw new ArgumentException("key cannot be empty string");
            long objectSize = 0;

            try
            {
                UsageStats stats = new UsageStats();
                stats.BeginSample();
                object lockId = (lockHandle == null) ? null : lockHandle.LockId;
                BitSet flagMap = new BitSet();
                short dsItemRemovedCallbackId = -1;

                CompressedValueEntry result = _cacheImpl.Remove(key, flagMap, lockId,  accessType);
                if (result != null && result.Value != null)
                {
                    if (result.Value != null && result.Value is CallbackEntry)
                    {
                        result.Value = ((CallbackEntry)result.Value).Value;
                    }
                    if (DebugAPIConfiguraions.LoggingEnabled)
                        objectSize = result.Value is byte[] ? ((byte[])result.Value).Length : 0;
                    result.Value = SafeDeserialize(result.Value, _serializationContext, result.Flag);
                    if (_perfStatsCollector != null)
                    {
                        stats.EndSample();
                        _perfStatsCollector.IncrementMsecPerDelSample(stats.Current);
                        _perfStatsCollector.IncrementDelPerSecStats();
                    }
                    if (DebugAPIConfiguraions.LoggingEnabled)
                        LogSizeInfo(false, objectSize);
                    return result.Value;
                }
                else
                {
                    if (_perfStatsCollector != null)
                    {
                        stats.EndSample();
                        _perfStatsCollector.IncrementMsecPerDelSample(stats.Current);
                        _perfStatsCollector.IncrementDelPerSecStats();
                    }
                }

            }
            catch (Exception)
            {
                if (ExceptionsEnabled) throw;
            }
            return null;
        }
Ejemplo n.º 46
0
 public virtual void Delete(string key, BitSet flagMap, short dsItemRemovedCallbackId, object lockId, LockAccessType accessType)
 {
 }
Ejemplo n.º 47
0
        public override CacheEntry GetGroup(object key, string group, string subGroup, ref ulong version, ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType accessType, OperationContext operationContext)
        {
            CacheEntry entry = null;

            base.Sync.AcquireReaderLock(-1);
            try
            {
                entry = this.Internal.GetGroup(key, group, subGroup, ref version, ref lockId, ref lockDate, lockExpiration, accessType, operationContext);
            }
            finally
            {
                base.Sync.ReleaseReaderLock();
            }
            return(entry);
        }
Ejemplo n.º 48
0
        /// <summary>
        /// Retrieve the object from the cache. A string key is passed as parameter.
        /// </summary>
        /// <param name="key">key of the entry.</param>
        /// <param name="lockId"></param>
        /// <param name="lockDate"></param>
        /// <param name="lockExpiration"></param>
        /// <param name="accessType"></param>
        /// <param name="operationContext"></param>
        /// <returns>cache entry.</returns>
        public override CacheEntry Get(object key, ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType accessType, OperationContext operationContext)
        {
            CacheEntry entry = Internal.Get(key, ref lockId, ref lockDate, lockExpiration, accessType, operationContext);

            if (entry != null && KeepDeflattedValues)
            {
                entry.KeepDeflattedValue(_context.SerializationContext);
            }
            return(entry);
        }
Ejemplo n.º 49
0
 public override CacheInsResultWithEntry Insert(object key, CacheEntry cacheEntry, bool notify, string taskId, object lockId, ulong version, LockAccessType access, OperationContext operationContext)
 {
     base.Sync.AcquireWriterLock(-1);
     try
     {
         return(this.Internal.Insert(key, cacheEntry, notify, lockId, version, access, operationContext));
     }
     finally
     {
         base.Sync.ReleaseWriterLock();
     }
 }
Ejemplo n.º 50
0
        /// <summary>
        /// Remove the object from the cluster.
        /// </summary>
        /// <param name="dest"></param>
        /// <param name="key">key of the entry.</param>
        /// <returns>cache entry.</returns>
        /// <remarks>
        /// This method invokes <see cref="handleRemove"/> on every server node in the cluster.
        /// </remarks>
        protected CacheEntry Clustered_Remove(Address dest, object key, ItemRemoveReason ir, CallbackEntry cbEntry, bool notify, object lockId, LockAccessType accessType, OperationContext operationContext)
        {
            if (ServerMonitor.MonitorActivity)
            {
                ServerMonitor.LogClientActivity("PartCacheBase.Remove", "");
            }

            CacheEntry retVal = null;

            try
            {
                Function func = new Function((int)OpCodes.Remove, new object[] { key, ir, notify, cbEntry, lockId, accessType, operationContext }, false);
                func.ResponseExpected = true;
                object result = Cluster.SendMessage(dest, func, GroupRequest.GET_FIRST, false);
                if (result != null)
                {
                    retVal = ((OperationResponse)result).SerializablePayload as CacheEntry;
                    if (retVal != null)
                    {
                        retVal.Value = ((OperationResponse)result).UserPayload;
                    }
                }
            }
            catch (Runtime.Exceptions.SuspectedException se)
            {
                throw;
            }
            catch (Runtime.Exceptions.TimeoutException te)
            {
                throw;
            }
            catch (CacheException e)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new GeneralFailureException(e.Message, e);
            }
            return(retVal);
        }
Ejemplo n.º 51
0
 /// <summary>
 /// Remove a entrada associada com a chave informada.
 /// </summary>
 /// <param name="key">Chave da entrada que será apagada.</param>
 /// <param name="ir"></param>
 /// <param name="notify"></param>
 /// <param name="taskId"></param>
 /// <param name="lockId"></param>
 /// <param name="version"></param>
 /// <param name="accessType"></param>
 /// <param name="operationContext"></param>
 /// <returns></returns>
 public override CacheEntry Remove(object key, ItemRemoveReason ir, bool notify, string taskId, object lockId, ulong version, LockAccessType accessType, OperationContext operationContext)
 {
     base.Sync.AcquireWriterLock(-1);
     try
     {
         return(this.Internal.Remove(key, ir, notify, lockId, version, accessType, operationContext));
     }
     finally
     {
         base.Sync.ReleaseWriterLock();
     }
 }
Ejemplo n.º 52
0
        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;
        }
Ejemplo n.º 53
0
 /// <summary>
 /// Retrieve the object from the cache. A string key is passed as parameter.
 /// </summary>
 /// <param name="key">key of the entry.</param>
 /// <param name="lockId"></param>
 /// <param name="lockDate"></param>
 /// <param name="lockExpiration"></param>
 /// <param name="accessType"></param>
 /// <param name="operationContext"></param>
 /// <returns>cache entry.</returns>
 public sealed override CacheEntry Get(object key, ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType accessType, OperationContext operationContext)
 {
     return Get(key, true, ref lockId, ref lockDate, lockExpiration, accessType, operationContext);
 }
Ejemplo n.º 54
0
        ///  <summary>
        ///  Removes the object from the <see cref="Cache"/>.
        ///  </summary>
        /// <param name="key">The cache key used to reference the item.</param>
        /// <returns>The item removed from the Cache. If the value in the key parameter 
        /// is not found, returns a null reference (Nothing in Visual Basic).</returns>
        /// <exception cref="ArgumentNullException"><paramref name="key"/> contains a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentException"><paramref name="key"/> is not serializable.</exception>
        /// <remarks>
        /// <para><b>Note:</b> If exceptions are enabled through the <see cref="NCache.ExceptionsEnabled"/> 
        /// setting, this property throws exception incase of failure.</para>
        /// </remarks>
        /// <example>The following example demonstrates how you can remove an item from your application's 
        /// <see cref="Cache"/> object.
        /// <code>
        /// 
        ///	NCache.Cache.Remove("timestamp");
        /// 
        /// </code>
        /// Or simply in a class deriving from <see cref="Alachisoft.NCache.Web.UI.NPage"/> or <see cref="Alachisoft.NCache.Web.UI.NUserControl"/>.
        /// <code>
        /// 
        ///	Cache.Remove("timestamp");
        /// 
        /// </code>
        /// </example>
        public override CompressedValueEntry Remove(string key, BitSet flagMap, object lockId, LockAccessType accessType)
        {
            RemoveCommand command = new RemoveCommand(key, flagMap, lockId, accessType);

            Request request = _broker.CreateRequest(command);
            _broker.ExecuteRequest(request);

            CommandResponse res = request.Response;
            res.ParseResponse();

            return res.FlagValueEntry;
        }
Ejemplo n.º 55
0
 public sealed override CacheInsResultWithEntry Insert(object key, CacheEntry cacheEntry, bool notify, object lockId, LockAccessType accessType, OperationContext operationContext)
 {
     return Insert(key, cacheEntry, notify, true, lockId, accessType, operationContext);
 }
Ejemplo n.º 56
0
 public virtual CompressedValueEntry Get <T>(string key, BitSet flagMap, string group, string subGroup, ref LockHandle lockHandle, TimeSpan lockTimeout, LockAccessType accessType)
 {
     return(null);
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Removes the object and key pair from the cache. The key is specified as parameter.
 /// Moreover it take a removal reason and a boolean specifying if a notification should
 /// be raised.
 /// </summary>
 /// <param name="key">key of the entry.</param>
 /// <param name="removalReason">reason for the removal.</param>
 /// <param name="notify">boolean specifying to raise the event.</param>
 /// <param name="lockId"></param>
 /// <param name="accessType"></param>
 /// <param name="operationContext"></param>
 /// <returns>item value</returns>
 public sealed override CacheEntry Remove(object key, ItemRemoveReason removalReason, bool notify, object lockId, LockAccessType accessType, OperationContext operationContext)
 {
     return Remove(key, removalReason, notify, true, lockId, accessType, operationContext);
 }
Ejemplo n.º 58
0
 public virtual object GetCacheItem(string key, BitSet flagMap, ref LockHandle lockHandle, TimeSpan lockTimeout, LockAccessType accessType)
 {
     return(null);
 }
Ejemplo n.º 59
0
 public override CacheEntry GetGroup(object key, string group, string subGroup, ref ulong version, ref object lockId, ref DateTime lockDate, LockExpiration lockExpiration, LockAccessType accessType, OperationContext operationContext)
 {
     if (_grpIndexManager.KeyExists(key, group, subGroup))
     {
         return(this.Get(key, ref version, ref lockId, ref lockDate, lockExpiration, accessType, operationContext));
     }
     return(null);
 }
Ejemplo n.º 60
0
 public virtual void Insert(string key, object value, DateTime absoluteExpiration,
                            TimeSpan slidingExpiration, CacheItemPriority priority, short onRemoveCallback, short onUpdateCallback, short onDsItemUpdatedCallback, bool isResyncExpiredItems,
                            Hashtable queryInfo, BitSet flagMap, object lockId, LockAccessType accessType, string providerName,
                            string resyncProviderName, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, long size, bool encryptionEnabled, string clientId, string typeName, CallbackType callbackType = CallbackType.PushBasedNotification)
 {
 }