Example #1
0
        public static EvictionHint ReadEvcHint(CompactReader reader)
        {
            EvictionHintType expHint = EvictionHintType.Parent;

            expHint = (EvictionHintType)reader.ReadInt16();
            EvictionHint tmpObj = null;

            switch (expHint)
            {
            case EvictionHintType.NULL:
                return(null);

            case EvictionHintType.Parent:
                tmpObj = (EvictionHint)reader.ReadObject();
                return((EvictionHint)tmpObj);

            case EvictionHintType.PriorityEvictionHint:
                PriorityEvictionHint peh = new PriorityEvictionHint();
                ((ICompactSerializable)peh).Deserialize(reader);
                return((EvictionHint)peh);

            default:
                break;
            }
            return(null);
        }
Example #2
0
 /// <summary>
 /// Check if the provided eviction hint is compatible with the policy
 /// and return the compatible eviction hint
 /// </summary>
 /// <param name="eh">eviction hint.</param>
 /// <returns>a hint compatible to the eviction policy.</returns>
 public EvictionHint CompatibleHint(EvictionHint eh, PoolManager pool)
 {
     if (eh != null && eh is PriorityEvictionHint)
     {
         return(eh);
     }
     return(PriorityEvictionHint.Create(pool, _priority));
 }
Example #3
0
        //#endregion

        public static EvictionHint ReadEvcHint(CompactReader reader, PoolManager poolManager)
        {
            EvictionHintType expHint = EvictionHintType.Parent;

            expHint = (EvictionHintType)reader.ReadInt16();
            EvictionHint tmpObj = null;

            switch (expHint)
            {
            case EvictionHintType.NULL:
                return(null);

            case EvictionHintType.Parent:
                tmpObj = (EvictionHint)reader.ReadObject();
                return(tmpObj);

            case EvictionHintType.CounterHint:
                var ch = CounterHint.Create(poolManager);
                ((ICompactSerializable)ch).Deserialize(reader);
                return(ch);

            case EvictionHintType.PriorityEvictionHint:
                var peh = PriorityEvictionHint.Create(poolManager);
                ((ICompactSerializable)peh).Deserialize(reader);
                return(peh);

            case EvictionHintType.TimestampHint:
                var tsh = TimestampHint.Create(poolManager);
                ((ICompactSerializable)tsh).Deserialize(reader);
                return(tsh);

            default:
                break;
            }
            return(null);
        }
Example #4
0
        public static EvictionHint ReadEvcHint(CompactReader reader)
        {
            EvictionHintType expHint = EvictionHintType.Parent;
            expHint = (EvictionHintType)reader.ReadInt16();
            EvictionHint tmpObj = null;
            switch (expHint)
            {
                case EvictionHintType.NULL:
                    return null;
                
                case EvictionHintType.Parent:
                    tmpObj = (EvictionHint)reader.ReadObject();
                    return (EvictionHint)tmpObj;

                case EvictionHintType.PriorityEvictionHint:
                    PriorityEvictionHint peh = new PriorityEvictionHint();
                    ((ICompactSerializable)peh).Deserialize(reader);
                    return (EvictionHint)peh;            
                
                default:
                    break;            
            }
            return null;
        }