Ejemplo n.º 1
0
        internal override CacheAddResult AddInternal(object key, CacheEntry cacheEntry, bool isUserOperation)
        {
            int bucketId = GetBucketId(key as string);

            if (_logMgr.IsOperationAllowed(bucketId) && LocalBuckets.Contains(bucketId))
            {
                if (_logMgr.IsLoggingEnbaled(bucketId, LogMode.LogBeforeActualOperation) && isUserOperation)
                {
                    _logMgr.LogOperation(bucketId, key, cacheEntry, OperationType.Add);
                    return(CacheAddResult.Success);
                }

                CacheEntry     clone  = (CacheEntry)cacheEntry.Clone();
                CacheAddResult result = base.AddInternal(key, cacheEntry, isUserOperation);

                if (result == CacheAddResult.Success || result == CacheAddResult.SuccessNearEviction)
                {
                    IncrementBucketStats(key as string, bucketId, clone.DataSize);
                    if (isUserOperation)
                    {
                        _logMgr.LogOperation(bucketId, key, clone, OperationType.Add);
                    }
                }

                return(result);
            }

            throw new StateTransferException("I am no more the owner of this bucket");
        }
Ejemplo n.º 2
0
 private bool IsBucketTransfered(int bucketId)
 {
     return(!_logMgr.IsOperationAllowed(bucketId));
 }