Пример #1
1
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="cacheClient">The cache client.</param>
        public DacheMvcChildActionCache(ICacheClient cacheClient)
            : base("Dache MVC Child Action Cache")
        {
            // Sanitize
            if (cacheClient == null)
            {
                throw new ArgumentNullException("cacheClient");
            }

            _cacheClient = cacheClient;
        }
Пример #2
0
 public AccountController(IDbConnection db, IMetricTracker metrics, ICacheClient cache, IMailController mailController, IUserService userService, IUserAuthenticationService authenticationService)
     : base(db, metrics, cache)
 {
     _mailController = mailController;
     _userService = userService;
     _authenticationService = authenticationService;
 }
 public ThrottleBotsPlugin(ICacheClient cacheClient, IEventRepository eventRepository, IProjectRepository projectRepository, IMetricsClient metricsClient, IQueue<WorkItemData> workItemQueue) {
     _cacheClient = cacheClient;
     _metricsClient = metricsClient;
     _eventRepository = eventRepository;
     _projectRepository = projectRepository;
     _workItemQueue = workItemQueue;
 }
Пример #4
0
 public ThrottlingHandler(ICacheClient cacheClient, IMetricsClient metricsClient, Func<string, long> maxRequestsForUserIdentifier, TimeSpan period, string message = "The allowed number of requests has been exceeded.") {
     _cacheClient = cacheClient;
     _metricsClient = metricsClient;
     _maxRequestsForUserIdentifier = maxRequestsForUserIdentifier;
     _period = period;
     _message = message;
 }
Пример #5
0
 public SessionPlugin(ICacheClient cacheClient, IEventRepository eventRepository, AssignToStackAction assignToStack, UpdateStatsAction updateStats, LocationPlugin locationPlugin, ILoggerFactory loggerFactory = null) : base(loggerFactory) {
     _cacheClient = new ScopedCacheClient(cacheClient, "session");
     _eventRepository = eventRepository;
     _assignToStack = assignToStack;
     _updateStats = updateStats;
     _locationPlugin = locationPlugin;
 }
 public SystemHealthChecker(ICacheClient cacheClient, IElasticClient elasticClient, IFileStorage storage, IQueue<StatusMessage> queue, IMessageBus messageBus) {
     _cacheClient = cacheClient;
     _elasticClient = elasticClient;
     _storage = storage;
     _queue = queue;
     _messageBus = messageBus;
 }
 public AutoSessionPlugin(ICacheClient cacheClient, IEventRepository eventRepository, AssignToStackAction assignToStack, UpdateStatsAction updateStats, LocationPlugin locationPlugin) {
     _cacheClient = new ScopedCacheClient(cacheClient, "session");
     _eventRepository = eventRepository;
     _assignToStack = assignToStack;
     _updateStats = updateStats;
     _locationPlugin = locationPlugin;
 }
 public SetLocationFromGeoWorkItemHandler(ICacheClient cacheClient, IEventRepository eventRepository, IGeocodeService geocodeService, IMetricsClient metricsClient, IMessageBus messageBus, ILoggerFactory loggerFactory = null) : base(loggerFactory) {
     _cacheClient = new ScopedCacheClient(cacheClient, "geo");
     _eventRepository = eventRepository;
     _geocodeService = geocodeService;
     _metricsClient = metricsClient;
     _lockProvider = new CacheLockProvider(cacheClient, messageBus);
 }
Пример #9
0
 public StatsController(ErrorStatsHelper statsHelper, IOrganizationRepository organizationRepository, IErrorStackRepository errorStackRepository, IProjectRepository projectRepository, ICacheClient cacheClient) {
     _cacheClient = cacheClient;
     _statsHelper = statsHelper;
     _organizationRepository = organizationRepository;
     _errorStackRepository = errorStackRepository;
     _projectRepository = projectRepository;
 }
		public void OnBeforeEachTest()
		{
			if (cacheClient != null)
				cacheClient.Dispose();

			cacheClient = new RedisClient(TestConfig.SingleHost);
			cacheClient.FlushAll();
		}
Пример #11
0
 protected BaseController(IDbConnection db, IMetricTracker metrics, ICacheClient cache)
 {
     Db = db;
     Metrics = metrics;
     Log = LogManager.GetLogger(GetType());
     Cache = cache;
     CacheContext = new CacheContext(Cache);
 }
        public virtual void OneTimeSetUp()
        {
            var serializer = GetSerializer();

            // Configured via app.config
            var conn = RedisConnectionManager.Instance.GetDefaultConnection();
            _client = new StackExchangeRedisCacheClient(conn, serializer);
        }
 public RemoveProjectWorkItemHandler(IProjectRepository projectRepository, IEventRepository eventRepository, IStackRepository stackRepository, ITokenRepository tokenRepository, IWebHookRepository webHookRepository, ICacheClient cacheClient, IMessageBus messageBus, ILoggerFactory loggerFactory = null) : base(loggerFactory) {
     _projectRepository = projectRepository;
     _eventRepository = eventRepository;
     _stackRepository = stackRepository;
     _tokenRepository = tokenRepository;
     _webHookRepository = webHookRepository;
     _lockProvider = new CacheLockProvider(cacheClient, messageBus);
 }
 public void OnBeforeEachTest()
 {
     cacheClient = new MemoryCacheClient();
     //cacheClient = new RedisCacheClient(TestConfig.SingleHost);
     cacheClient.FlushAll();
     model = ModelWithIdAndName.Create(1);
     xmlModel = DataContractSerializer.Instance.Parse(model);
 }
 public MyAppElasticConfiguration(IQueue<WorkItemData> workItemQueue, ICacheClient cacheClient, IMessageBus messageBus, ILoggerFactory loggerFactory) : base(workItemQueue, cacheClient, messageBus, loggerFactory) {
     AddIndex(Identities = new IdentityIndex(this));
     AddIndex(Employees = new EmployeeIndex(this));
     AddIndex(MonthlyEmployees = new MonthlyEmployeeIndex(this, 1));
     AddIndex(DailyLogEvents = new DailyLogEventIndex(this));
     AddIndex(MonthlyLogEvents = new MonthlyLogEventIndex(this));
     AddIndex(ParentChild = new ParentChildIndex(this));
 }
Пример #16
0
 public DailySummaryJob(IProjectRepository projectRepository, IOrganizationRepository organizationRepository, IUserRepository userRepository, IEventRepository eventRepository, EventStats stats, IMailer mailer, ICacheClient cacheClient, ILoggerFactory loggerFactory = null) : base(loggerFactory) {
     _projectRepository = projectRepository;
     _organizationRepository = organizationRepository;
     _userRepository = userRepository;
     _eventRepository = eventRepository;
     _stats = stats;
     _mailer = mailer;
     _lockProvider = new ThrottlingLockProvider(cacheClient, 1, TimeSpan.FromHours(1));
 }
        public CacheBucketMetricsClientBase(ICacheClient cache, bool buffered = true, string prefix = null, ILoggerFactory loggerFactory = null) {
            _logger = loggerFactory.CreateLogger(GetType());
            _cache = cache;
            _buffered = buffered;
            _prefix = !String.IsNullOrEmpty(prefix) ? (!prefix.EndsWith(":") ? prefix + ":" : prefix) : String.Empty;

            if (buffered)
                _flushTimer = new Timer(OnMetricsTimer, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2));
        }
Пример #18
0
        public ThrottlingLockProvider(ICacheClient cacheClient, int maxHitsPerPeriod = 100, TimeSpan? throttlingPeriod = null) {
            _cacheClient = cacheClient;
            _maxHitsPerPeriod = maxHitsPerPeriod;

            if (maxHitsPerPeriod <= 0)
                throw new ArgumentException("Must be a positive number.", nameof(maxHitsPerPeriod));
            
            if (throttlingPeriod.HasValue)
                _throttlingPeriod = throttlingPeriod.Value;
        }
Пример #19
0
        public ThrottlingLockProvider(ICacheClient cacheClient, int maxHitsPerPeriod = 100, TimeSpan? throttlingPeriod = null, ILoggerFactory loggerFactory = null) {
            _logger = loggerFactory.CreateLogger<ThrottlingLockProvider>();
            _cacheClient = new ScopedCacheClient(cacheClient, "lock:throttled");
            _maxHitsPerPeriod = maxHitsPerPeriod;

            if (maxHitsPerPeriod <= 0)
                throw new ArgumentException("Must be a positive number.", nameof(maxHitsPerPeriod));
            
            if (throttlingPeriod.HasValue)
                _throttlingPeriod = throttlingPeriod.Value;
        }
Пример #20
0
        public MigrationJobBase(IElasticClient elasticClient, EventUpgraderPluginManager eventUpgraderPluginManager, EventIndex eventIndex, StackIndex stackIndex, IValidator<Stack> stackValidator, IValidator<PersistentEvent> eventValidator, IGeoIPResolver geoIpResolver, ILockProvider lockProvider, ICacheClient cache) {
            _eventUpgraderPluginManager = eventUpgraderPluginManager;
            _mongoDatabase = GetMongoDatabase();
            _eventRepository = new EventMigrationRepository(elasticClient, eventIndex, eventValidator);
            _stackRepository = new StackMigrationRepository(elasticClient, stackIndex, _eventRepository, stackValidator);
            _geoIpResolver = geoIpResolver;
            _lockProvider = lockProvider;
            _cache = cache;

            _batchSize = MigrationSettings.Current.MigrationBatchSize;
        }
Пример #21
0
 public StatusController(ICacheClient cacheClient, IMessagePublisher messagePublisher, SystemHealthChecker healthChecker, IQueue<EventPost> eventQueue, IQueue<MailMessage> mailQueue, IQueue<EventNotificationWorkItem> notificationQueue, IQueue<WebHookNotification> webHooksQueue, IQueue<EventUserDescription> userDescriptionQueue, IMetricsClient metricsClient) {
     _cacheClient = cacheClient;
     _messagePublisher = messagePublisher;
     _healthChecker = healthChecker;
     _eventQueue = eventQueue;
     _mailQueue = mailQueue;
     _notificationQueue = notificationQueue;
     _webHooksQueue = webHooksQueue;
     _userDescriptionQueue = userDescriptionQueue;
     _metricsClient = metricsClient;
 }
Пример #22
0
        public CachedEventService(TimeSpan? ttl, ICacheClient client, ICacheKeyBuilder<Guid> keyBuilder, ILogFactory factory)
        {
            if (client == null) throw new ArgumentNullException("client");
            if (keyBuilder == null) throw new ArgumentNullException("keyBuilder");
            if (factory == null) throw new ArgumentNullException("factory");

            this.ttl = ttl;
            this.client = client;
            this.factory = factory;
            this.keyBuilder = keyBuilder;
        }
 public EventNotificationsJob(IQueue<EventNotificationWorkItem> queue, IMailer mailer,
     IOrganizationRepository organizationRepository, IProjectRepository projectRepository, IStackRepository stackRepository,
     IUserRepository userRepository, IEventRepository eventRepository, ICacheClient cacheClient) {
     _queue = queue;
     _mailer = mailer;
     _organizationRepository = organizationRepository;
     _projectRepository = projectRepository;
     _stackRepository = stackRepository;
     _userRepository = userRepository;
     _eventRepository = eventRepository;
     _cacheClient = cacheClient;
 }
		protected CacheClientTestBase(ISerializer serializer)
		{
			Serializer = serializer;
		    var mux = ConnectionMultiplexer.Connect(new ConfigurationOptions
		    {
		        DefaultVersion = new Version(3, 0, 500),
		        EndPoints = {{"localhost", 6379}},
		        AllowAdmin = true
		    });

            Sut = new StackExchangeRedisCacheClient(mux, Serializer);
			Db = Sut.Database;
		}
        public void SetupTests()
        {

            _client = new DynamoDbCacheClient(yourAwsAccountKey, yourAwsSecretKey,
                                              RegionEndpoint.USEast1, "ICacheClientDynamoDb", 10, 5, true);
            // The primary item we'll be caching in the tests.
            _item = new DummyObject
                        {
                            UserId = "john.doe",
                            Email = "*****@*****.**",
                            Phone = "555-555-9876",
                            Friends = new List<string> {"jane.doe", "jack.doe", "some.friend"}
                        };            
        }
Пример #26
0
        public static void CacheAllWorlds(this IDbConnection db, ICacheClient cache)
        {
            cache.FlushAll();

            // concurrently create a list of world ids
            var worlds = db.GetWorlds();

            Parallel.ForEach<World>(worlds, w =>
            {
                var cacheKey = UrnId.Create<World>("Id", w.id.ToString());

                cache.Set<World>(cacheKey, w);
            });
        }
Пример #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BoardsService"/> class.
        /// </summary>
        /// <param name="boardsRepository">
        /// The boards repository.
        /// </param>
        /// <param name="cacheClient">
        /// The cache Client.
        /// </param>
        public BoardsService(IBoardsRepository boardsRepository, ICacheClient cacheClient)
        {
            if (boardsRepository == null)
            {
                throw new ArgumentNullException("boardsRepository", "Boards repository is required.");
            }

            if (cacheClient == null)
            {
                throw new ArgumentNullException("cacheClient", "Cache client is required.");
            }

            this.boardsRepository = boardsRepository;
            this.cacheClient = cacheClient;
        }
 public CityDetailsPageViewModel(IClock clock, IDataRepository repository, 
     IEventAggregator eventAggregator, 
     INavigationService navigationService,
     ICacheClient cacheClient)
 {
     _clock = clock;
     _repository = repository;
     _eventAggregator = eventAggregator;
     _navigationService = navigationService;
     _cacheClient = cacheClient;
     var clocks = _repository.GetUsersCities();
     Clocks = new ObservableCollection<CityInfo>(clocks);
     ApplySelection = new DelegateCommand<SelectionChangedEventArgs>(ApplySelectionInternal);
     Delete = new RelayCommand(HandleDelete);
 }
Пример #29
0
        /// <summary>
        /// Static constructor.
        /// </summary>
        static DacheOutputCacheProvider()
        {
            // Use the user provided settings
            var cacheClientConfig = CacheClientConfigurationSection.Settings;

            if (cacheClientConfig == null) throw new InvalidOperationException("You cannot use the Dache output cache provider without supplying Dache configuration in your web or app config file");

            // TODO: the below sucks. Improve it.

            // Clone to protect from mutated state
            var cacheClientConfigClone = (CacheClientConfigurationSection)cacheClientConfig.Clone();
            // Use binary serializer
            cacheClientConfigClone.CustomSerializer.Type = typeof(BinarySerializer).AssemblyQualifiedName;
            // Use Debug logger
            cacheClientConfigClone.CustomLogger.Type = typeof(DebugLogger).AssemblyQualifiedName;
            _cacheClient = new CacheClient(cacheClientConfigClone);
        }
        protected static void AssertCacheClientMissingModelValuesAsKeysWithNullValues(
			ICacheClient cacheClient)
        {
            var allKeys = new[] { "test:modelkey1", "test:modelkey2", "test:modelkey3" };
            var expectedValues = new[] { ModelWithIdAndName.Create(1), null, ModelWithIdAndName.Create(1) };
            cacheClient.Set(allKeys[0], expectedValues[0]);
            cacheClient.Set(allKeys[2], expectedValues[2]);

            var keyValues = cacheClient.GetAll<ModelWithIdAndName>(allKeys);
            Assert.That(keyValues, Has.Count.EqualTo(expectedValues.Length));

            for (var keyIndex = 0; keyIndex < expectedValues.Length; keyIndex++)
            {
                var key = allKeys[keyIndex];
                var keyValue = keyValues[key];

                ModelWithIdAndName.AssertIsEqual(keyValue, expectedValues[keyIndex]);
            }
        }
Пример #31
0
 public static Task <IDictionary <string, CacheValue <T> > > GetAllAsync <T>(this ICacheClient client, params string[] keys)
 {
     return(client.GetAllAsync <T>(keys.ToArray()));
 }
 public CloseInactiveSessionsJob(IEventRepository eventRepository, ICacheClient cacheClient, ILoggerFactory loggerFactory = null) : base(loggerFactory)
 {
     _eventRepository = eventRepository;
     _cache           = cacheClient;
     _lockProvider    = new ThrottlingLockProvider(cacheClient, 1, TimeSpan.FromMinutes(1));
 }
Пример #33
0
 public EventRepository(MongoDatabase database, IProjectRepository projectRepository, IOrganizationRepository organizationRepository, ICacheClient cacheClient = null, IMessagePublisher messagePublisher = null)
     : base(database, cacheClient, messagePublisher)
 {
     _projectRepository      = projectRepository;
     _organizationRepository = organizationRepository;
 }
Пример #34
0
 public static void ClearSession(this ICacheClient cache, IRequest httpReq = null)
 {
     cache.Remove(GetSessionKey(httpReq));
 }
Пример #35
0
 public RestrictedAttribute()
 {
     Cache = StructureMap.ObjectFactory.GetInstance <ICacheClient>();
 }
Пример #36
0
 public UsageService(IOrganizationRepository organizationRepository, IProjectRepository projectRepository, ICacheClient cache, IMessagePublisher messagePublisher, ILoggerFactory loggerFactory = null)
 {
     _organizationRepository = organizationRepository;
     _projectRepository      = projectRepository;
     _cache            = cache;
     _messagePublisher = messagePublisher;
     _logger           = loggerFactory.CreateLogger <UsageService>();
 }
Пример #37
0
 /// <summary>
 /// Returning the most optimized result based on the MimeType and CompressionType from the IRequest.
 /// </summary>
 public static object ToOptimizedResultUsingCache <T>(
     this IRequest req, ICacheClient cacheClient, string cacheKey, Func <T> factoryFn)
 {
     return(req.ToOptimizedResultUsingCache(cacheClient, cacheKey, null, factoryFn));
 }
Пример #38
0
 public static Task <long> DecrementAsync(this ICacheClient client, string key, int amount = 1, TimeSpan?expiresIn = null)
 {
     return(client.IncrementAsync(key, -amount, expiresIn));
 }
 public CacheServiceManager(ICacheClient cacheService)
 {
     _cacheService = cacheService;
 }
Пример #40
0
 public static Task <bool> ReplaceAsync <T>(this ICacheClient client, string key, T value, DateTime?expiresAtUtc = null)
 {
     return(client.ReplaceAsync(key, value, expiresAtUtc?.Subtract(DateTime.UtcNow)));
 }
Пример #41
0
 public static Task <long> DecrementAsync(this ICacheClient client, string key, int amount = 1, DateTime?expiresAtUtc = null)
 {
     return(client.IncrementAsync(key, -amount, expiresAtUtc));
 }
Пример #42
0
        internal override ICacheClient TryExecute(ICacheClient client)
        {
            if (!CanExecute)
            {
                return(null);
            }

            if (Params.Count == 0)
            {
                Logger.Write("Available commands:");
                Logger.Write("");
                Logger.Write("COUNT     : count the objects matching a specified query");
                Logger.Write("SELECT    : get the objects matching a specified query as JSON");
                Logger.Write("DESC      : display information about the server process and data tables");
                Logger.Write("CONNECT   : connect to a server or a cluster of servers");

                Logger.Write("EXIT      : guess what?");


                Logger.Write("READONLY  : switch on the readonly mode");
                Logger.Write("READWRITE : switch off the readonly mode");

                Logger.Write("STOP      : stop all the nodes in the cluster");

                Logger.Write("DROP      : delete ALL DATA");

                Logger.Write("DELETE    : remove all the objects matching a query");
                Logger.Write("TRUNCATE  : remove all the objects of a given type");
                Logger.Write("DUMP      : save all the database in a directory ");
                Logger.Write("RESTORE   : restore data saved with the DUMP command (same number of nodes)");
                Logger.Write("RECREATE  : restore data saved with the DUMP command (number of nodes changed)");
                Logger.Write("IMPORT    : import data from an external json file");
                Logger.Write("LAST      : display information on the last actions executed by the server");
                Logger.Write("");
                Logger.Write("Type HELP <command> for detailed information");
            }
            else
            {
                switch (Params[0].ToUpper().Trim())
                {
                case "DESC":
                    Logger.Write("DESC          : display information about the server process and data tables");
                    Logger.Write("DESC table    : display the list of the index fields for the specified table");
                    break;

                case "COUNT":
                    Logger.Write("COUNT <table>  - counts all the items from a table");
                    Logger.Write("COUNT <table> WHERE <query>");
                    DisplayQueryHelp();
                    break;

                case "SELECT":
                    Logger.Write("SELECT <table> WHERE <query> [INTO file.json]");
                    DisplayQueryHelp();
                    Logger.Write("If INTO is used the data is saved as a json array in an external file");
                    break;

                case "DELETE":
                    Logger.Write("DELETE <table> WHERE <query>");
                    DisplayQueryHelp();

                    break;

                case "LAST":
                    Logger.Write("LAST <number> ");
                    Logger.Write("Exmple: last 10  = displays the most recent 10 actions on the server");
                    Logger.Write("Information includes server execution time and execution plan");
                    break;

                case "TRUNCATE":
                    Logger.Write("TRUNCATE <table> ");
                    break;

                case "DUMP":
                    Logger.Write("DUMP <existent directory> ");
                    Logger.Write("Saves all data in an external directory. The directory is usualy a network share ");
                    Logger.Write("It must be visible by ALL the servers");
                    Logger.Write("A subdirectory named yyyy-mm-dd will be created for the current date");
                    break;


                case "RESTORE":
                    Logger.Write("RESTORE <existent directory> ");
                    Logger.Write("Import data from a dump. The directory is usualy a network share ");
                    Logger.Write("It must be visible by ALL the servers");
                    Logger.Write("If the path contains yyyy-mm-dd this backup will be used. Otherwise the last one is restored");
                    Logger.Write("This method can be used ONLY if the number of nodes has not changed");
                    Logger.Write("ALL PREVIOUS DATA IS LOST");
                    break;

                case "IMPORT":
                    Logger.Write("IMPORT <JSON file> ");
                    Logger.Write("Import data from an external json file");
                    Logger.Write("Objects are inserted or updated");
                    break;

                case "RECREATE":
                    Logger.Write("RECREATE <existent directory> ");
                    Logger.Write("Import data from a dump. The directory must be accessible by the console client");
                    Logger.Write("The database must be completely empty. New one or after a DROP operation");
                    Logger.Write("This method is slower than RESTORE but it can be used even if the number of nodes has changed");
                    Logger.Write("ALL PREVIOUS DATA IS LOST");
                    break;

                case "CONNECT":
                    Logger.Write("Connect to a single node or a Cachalot cluster");
                    Logger.Write("connect (no parameter): by default connect to localhost 4848");
                    Logger.Write("connect server port   : connect to a specific node");
                    Logger.Write("connect config.xml    : connect to a cluster described by a configuration file");

                    break;
                }
            }

            return(client);
        }
Пример #43
0
 public static Task <int> SetAllAsync(this ICacheClient client, IDictionary <string, object> values, DateTime?expiresAtUtc = null)
 {
     return(client.SetAllAsync(values, expiresAtUtc?.Subtract(DateTime.UtcNow)));
 }
Пример #44
0
 public TagController(ICacheClient cacheClient, IBlogService blogService, IOptions <BlogOptions> blogOption)
 {
     _cacheClient = cacheClient;
     _blogService = blogService;
     _blogOptions = blogOption.Value;
 }
 public OrmLiteValidationSource(IDbConnectionFactory dbFactory, ICacheClient cache = null, TimeSpan?cacheDuration = null)
 {
     DbFactory = dbFactory ?? throw new ArgumentNullException(nameof(dbFactory));
     Cache     = cache;
 }
Пример #46
0
 public ProjectRepositoryTests(ITestOutputHelper output, AppWebHostFactory factory) : base(output, factory)
 {
     Log.MinimumLevel = LogLevel.Trace;
     _cache           = GetService <ICacheClient>();
     _repository      = GetService <IProjectRepository>();
 }
Пример #47
0
        public static async Task <T> GetAsync <T>(this ICacheClient client, string key, T defaultValue)
        {
            var cacheValue = await client.GetAsync <T>(key).AnyContext();

            return(cacheValue.HasValue ? cacheValue.Value : defaultValue);
        }
Пример #48
0
 public DiscordPacketHandler(IDiscordEventHandler eventHandler, IDiscordClient client, ICacheClient cacheClient)
 {
     EventHandler = eventHandler;
     Client       = client;
     CacheClient  = cacheClient;
 }
 protected ElasticSearchReadOnlyRepository(IElasticClient elasticClient, ICacheClient cacheClient = null)
 {
     _elasticClient = elasticClient;
     Cache          = cacheClient;
 }
 public OrganizationController(IOrganizationRepository organizationRepository, ICacheClient cacheClient, IUserRepository userRepository, IProjectRepository projectRepository, IQueue <WorkItemData> workItemQueue, BillingManager billingManager, IMailer mailer, IMessagePublisher messagePublisher, EventStats stats, ILoggerFactory loggerFactory, IMapper mapper) : base(organizationRepository, loggerFactory, mapper)
 {
     _cacheClient       = cacheClient;
     _userRepository    = userRepository;
     _projectRepository = projectRepository;
     _workItemQueue     = workItemQueue;
     _billingManager    = billingManager;
     _mailer            = mailer;
     _messagePublisher  = messagePublisher;
     _stats             = stats;
 }
Пример #51
0
 public ExceptionlessElasticConfiguration(IQueue <WorkItemData> workItemQueue, ICacheClient cacheClient, IMessageBus messageBus, ILoggerFactory loggerFactory) : base(workItemQueue, cacheClient, messageBus, loggerFactory)
 {
     _logger.Info().Message($"All new indexes will be created with {Settings.Current.ElasticSearchNumberOfShards} Shards and {Settings.Current.ElasticSearchNumberOfReplicas} Replicas");
     AddIndex(Stacks        = new StackIndex(this));
     AddIndex(Events        = new EventIndex(this));
     AddIndex(Organizations = new OrganizationIndex(this));
 }
Пример #52
0
 public static Task <long> IncrementAsync(this ICacheClient client, string key, int amount = 1, DateTime?expiresAtUtc = null)
 {
     return(client.IncrementAsync(key, amount, expiresAtUtc?.Subtract(DateTime.UtcNow)));
 }
Пример #53
0
 public static TUserSession SessionAs <TUserSession>(this ICacheClient cache,
                                                     IRequest httpReq = null, IResponse httpRes = null)
 {
     return(SessionFeature.GetOrCreateSession <TUserSession>(cache, httpReq, httpRes));
 }
Пример #54
0
 /// <summary>
 /// Initialize service with injectors.
 /// </summary>
 /// <param name="redisClient"></param>
 public ProfileCacheService([KeyFilter(AutofacKeyConstant.ProfileRedisCaching)] ICacheClient redisClient)
 {
     _redisClient = redisClient;
 }
Пример #55
0
 public WebHookRepository(MongoDatabase database, IValidator <WebHook> validator = null, ICacheClient cacheClient = null, IMessagePublisher messagePublisher = null) : base(database, validator, cacheClient, messagePublisher)
 {
 }
Пример #56
0
 public static async Task <bool> RemoveAsync(this ICacheClient client, string key)
 {
     return(await client.RemoveAllAsync(new[] { key }).AnyContext() == 1);
 }
 public QueueEventMigrationsJob(IQueue <EventMigrationBatch> queue, IElasticClient elasticClient, EventUpgraderPluginManager eventUpgraderPluginManager, IValidator <Stack> stackValidator, IValidator <PersistentEvent> eventValidator, IGeoIPResolver geoIpResolver, ILockProvider lockProvider, ICacheClient cache) : base(elasticClient, eventUpgraderPluginManager, stackValidator, eventValidator, geoIpResolver, lockProvider, cache)
 {
     _queue = queue;
 }
Пример #58
0
 public static Task SetExpirationAsync(this ICacheClient client, string key, DateTime expiresAtUtc)
 {
     return(client.SetExpirationAsync(key, expiresAtUtc.Subtract(DateTime.UtcNow)));
 }
Пример #59
0
 public UserController(IUserRepository userRepository, IOrganizationRepository organizationRepository, ITokenRepository tokenRepository, ICacheClient cacheClient, IMailer mailer, IMapper mapper, IAppQueryValidator validator, IntercomOptions intercomOptions, ILoggerFactory loggerFactory) : base(userRepository, mapper, validator, loggerFactory)
 {
     _organizationRepository = organizationRepository;
     _tokenRepository        = tokenRepository;
     _cache           = new ScopedCacheClient(cacheClient, "User");
     _mailer          = mailer;
     _intercomOptions = intercomOptions;
 }
Пример #60
0
 public RetentionLimitsJob(IOrganizationRepository organizationRepository, IEventRepository eventRepository, ICacheClient cacheClient, ILoggerFactory loggerFactory = null) : base(loggerFactory)
 {
     _organizationRepository = organizationRepository;
     _eventRepository        = eventRepository;
     _lockProvider           = new ThrottlingLockProvider(cacheClient, 1, TimeSpan.FromDays(1));
 }