Пример #1
0
        void IEvictionPolicy.Remove(object key, EvictionHint hint)
        {
            if (hint == null)
            {
                return;
            }

            lock (_index.SyncRoot)
            {
                TimeSpan diffTime = ((TimestampHint)hint).TimeStamp.Subtract(_initTime);
                long     indexKey = GetIndexKey(diffTime);
                _index.Remove(indexKey, key);
            }
        }
Пример #2
0
        public static void WriteEvcHint(CompactWriter writer, EvictionHint evcHint)
        {
            if (evcHint == null)
            {
                writer.Write((short)EvictionHintType.NULL);
                return;
            }

            writer.Write((short)evcHint._hintType);
            ((ICompactSerializable)evcHint).Serialize(writer);
            return;

            /*
             * switch (evcHint._hintType)
             * {
             *
             *  case EvictionHintType.Parent:
             *      ((ICompactSerializable)evcHint).Serialize(writer);
             *      break;
             *
             *  case EvictionHintType.CounterHint:
             *      ((ICompactSerializable)evcHint).Serialize(writer);
             *      break;
             *
             *  case EvictionHintType.PriorityEvictionHint:
             *      ((ICompactSerializable)evcHint).Serialize(writer);
             *      break;
             *
             *  case EvictionHintType.TimestampHint:
             *      ((ICompactSerializable)evcHint).Serialize(writer);
             *      break;
             *
             *  default:
             *      break;
             * }    */
        }