/// <summary>
        ///
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static IGlobalConfiguration <LiteDbStorage> UseLiteDbStorage(
            [NotNull] this IGlobalConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            var storage = new LiteDbStorage("Hangfire.db", new LiteDbStorageOptions());

            return(configuration.UseStorage(storage));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="nameOrConnectionString"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static IGlobalConfiguration <LiteDbStorage> UseLiteDbStorage(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] string nameOrConnectionString,
            LiteDbStorageOptions options = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (nameOrConnectionString == null)
            {
                throw new ArgumentNullException(nameof(nameOrConnectionString));
            }
            if (options == null)
            {
                options = new LiteDbStorageOptions();
            }
            var storage = new LiteDbStorage(nameOrConnectionString, options);

            return(configuration.UseStorage(storage));
        }
 /// <summary>
 /// Constructs Counter collection aggregator
 /// </summary>
 /// <param name="storage">LiteDB storage</param>
 /// <param name="interval">Checking interval</param>
 public CountersAggregator(LiteDbStorage storage, TimeSpan interval)
 {
     _storage  = storage ?? throw new ArgumentNullException(nameof(storage));
     _interval = interval;
 }
示例#4
0
 /// <summary>
 /// Constructs expiration manager with specified checking interval
 /// </summary>
 /// <param name="storage">LiteDB storage</param>
 /// <param name="checkInterval">Checking interval</param>
 public ExpirationManager(LiteDbStorage storage, TimeSpan checkInterval)
 {
     _storage       = storage ?? throw new ArgumentNullException(nameof(storage));
     _checkInterval = checkInterval;
 }
示例#5
0
 /// <summary>
 /// Constructs expiration manager with one hour checking interval
 /// </summary>
 /// <param name="storage">LiteDb storage</param>
 public ExpirationManager(LiteDbStorage storage)
     : this(storage, TimeSpan.FromHours(1))
 {
 }