/// <summary>
        ///     Ctor.
        /// </summary>
        /// <param name="maxAgeSec">is the maximum age in seconds</param>
        /// <param name="purgeIntervalSec">is the purge interval in seconds</param>
        /// <param name="cacheReferenceType">indicates whether hard, soft or weak references are used in the cache</param>
        /// <param name="agentInstanceContext">agent instance context</param>
        /// <param name="scheduleSlot">slot for scheduling callbacks for this cache</param>
        public HistoricalDataCacheExpiringImpl(
            double maxAgeSec,
            double purgeIntervalSec,
            CacheReferenceType cacheReferenceType,
            AgentInstanceContext agentInstanceContext,
            long scheduleSlot)
        {
            MaxAgeSec = maxAgeSec;
            PurgeIntervalSec = purgeIntervalSec;
            this._agentInstanceContext = agentInstanceContext;
            this._scheduleSlot = scheduleSlot;

            if (cacheReferenceType == CacheReferenceType.HARD) {
                _cache = new Dictionary<object, Item>()
                    .WithNullKeySupport();
            }
            else if (cacheReferenceType == CacheReferenceType.SOFT) {
                _cache = new ReferenceMap<object, Item>(
                        ReferenceType.SOFT,
                        ReferenceType.SOFT)
                    .WithNullKeySupport();
            }
            else {
                _cache = new WeakDictionary<object, Item>()
                    .WithNullKeySupport();
            }
        }
 /// <summary>
 /// Creates a new parameter attribute with a blank matching pattern
 /// </summary>
 /// <param name="usage">How the parameter is used in the command</param>
 /// <param name="type">The system type of the parameter expected</param>
 /// <param name="cacheTypes">How this parameter can be found (is it data, is it a live entity)</param>
 /// <param name="optional">Is this parameter optional</param>
 public CommandParameterAttribute(CommandUsage usage, Type type, CacheReferenceType[] cacheTypes, bool optional)
 {
     Usage = usage;
     ParameterType = type;
     CacheTypes = cacheTypes;
     RegExPattern = string.Empty;
     Optional = optional;
 }
示例#3
0
 /// <summary>
 /// Creates a new parameter attribute with a blank matching pattern
 /// </summary>
 /// <param name="usage">How the parameter is used in the command</param>
 /// <param name="type">The system type of the parameter expected</param>
 /// <param name="cacheType">How this parameter can be found (is it data, is it a live entity)</param>
 /// <param name="optional">Is this parameter optional</param>
 public CommandParameterAttribute(CommandUsage usage, Type type, CacheReferenceType cacheType, bool optional, bool requiresPreviousParameter = false)
 {
     Usage                     = usage;
     ParameterTypes            = new Type[] { type };
     CacheTypes                = new CacheReferenceType[] { cacheType };
     RegExPattern              = string.Empty;
     Optional                  = optional;
     RequiresPreviousParameter = requiresPreviousParameter;
 }
示例#4
0
 /// <summary>
 /// Creates a new parameter attribute
 /// </summary>
 /// <param name="usage">How the parameter is used in the command</param>
 /// <param name="type">The system type of the parameter expected</param>
 /// <param name="cacheType">How this parameter can be found (is it data, is it a live entity)</param>
 /// <param name="matchingPattern">Does this pattern keyword follow a regex pattern</param>
 /// <param name="optional">Is this parameter optional</param>
 public CommandParameterAttribute(CommandUsage usage, Type[] types, CacheReferenceType cacheType, string matchingPattern, bool optional, bool requiresPreviousParameter = false)
 {
     Usage                     = usage;
     ParameterTypes            = types;
     CacheTypes                = new CacheReferenceType[] { cacheType };
     RegExPattern              = matchingPattern;
     Optional                  = optional;
     RequiresPreviousParameter = requiresPreviousParameter;
 }
 /// <summary>
 ///     Ctor.
 /// </summary>
 /// <param name="maxAgeSeconds">is the maximum age in seconds</param>
 /// <param name="purgeIntervalSeconds">is the purge interval</param>
 /// <param name="cacheReferenceType">
 ///     the reference type may allow garbage collection to remove entries fromcache unless HARD reference type indicates
 ///     otherwise
 /// </param>
 public ConfigurationCommonCacheExpiryTime(
     double maxAgeSeconds,
     double purgeIntervalSeconds,
     CacheReferenceType cacheReferenceType)
 {
     MaxAgeSeconds = maxAgeSeconds;
     PurgeIntervalSeconds = purgeIntervalSeconds;
     CacheReferenceType = cacheReferenceType;
 }
 /// <summary>
 ///     Configures an expiry-time cache of the given maximum age in seconds and purge interval in seconds. Also allows
 ///     setting the reference type indicating whether garbage collection may remove entries from cache.
 /// </summary>
 /// <param name="maxAgeSeconds">
 ///     is the maximum number of seconds before a method invocation result is considered stale
 ///     (also known as time-to-live)
 /// </param>
 /// <param name="purgeIntervalSeconds">is the interval at which the runtime purges stale data from the cache</param>
 /// <param name="cacheReferenceType">specifies the reference type to use</param>
 public void SetExpiryTimeCache(
     double maxAgeSeconds,
     double purgeIntervalSeconds,
     CacheReferenceType cacheReferenceType)
 {
     DataCacheDesc = new ConfigurationCommonCacheExpiryTime(
         maxAgeSeconds,
         purgeIntervalSeconds,
         cacheReferenceType);
 }