Beispiel #1
0
        public static EvictionPolicy Create(IPayloadReader reader)
        {
            EvictionType type = (EvictionType)reader.ReadByte("Type");

            EvictionPolicy result;

            switch (type)
            {
            case EvictionType.None:
                return(null);

            case EvictionType.BySize:
                result = new CollectionSizePolicy();
                break;

            case EvictionType.ByTime:
                result = new ObjectExpirationPolicy();
                break;

            default:
                throw new NotSupportedException();
            }
            result.Deserialize(reader);
            return(result);
        }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            CollectionSizePolicy other = obj as CollectionSizePolicy;

            if (other == null)
            {
                return(false);
            }

            if (this.ScanPeriod != other.ScanPeriod ||
                this.MaxObjectCount != other.MaxObjectCount)
            {
                return(false);
            }

            return(true);
        }
Beispiel #3
0
        public static EvictionPolicy Create(IPayloadReader reader)
        {
            EvictionType type = (EvictionType)reader.ReadByte("Type");

            EvictionPolicy result;
            switch (type)
            {
                case EvictionType.None:
                    return null;

                case EvictionType.BySize:
                    result = new CollectionSizePolicy();
                    break;

                case EvictionType.ByTime:
                    result = new ObjectExpirationPolicy();
                    break;

                default:
                    throw new NotSupportedException();
            }
            result.Deserialize(reader);
            return result;
        }