public CombinatorService(
            ICacheFileService cacheFileService,
            IResourceProcessingService resourceProcessingService,
            ILockingCacheManager lockingCacheManager,
            ICombinatorEventMonitor combinatorEventMonitor,
            ICombinatorResourceManager combinatorResourceManager)
        {
            _cacheFileService = cacheFileService;
            _resourceProcessingService = resourceProcessingService;
            _lockingCacheManager = lockingCacheManager;
            _combinatorEventMonitor = combinatorEventMonitor;
            _combinatorResourceManager = combinatorResourceManager;

            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;
        }
Exemple #2
0
        public CombinatorService(
            ICacheFileService cacheFileService,
            IResourceProcessingService resourceProcessingService,
            ILockingCacheManager lockingCacheManager,
            ICombinatorEventMonitor combinatorEventMonitor,
            ILockFileManager lockFileManager,
            ICombinatorResourceManager combinatorResourceManager)
        {
            _cacheFileService          = cacheFileService;
            _resourceProcessingService = resourceProcessingService;
            _lockingCacheManager       = lockingCacheManager;
            _combinatorEventMonitor    = combinatorEventMonitor;
            _lockFileManager           = lockFileManager;
            _combinatorResourceManager = combinatorResourceManager;

            Logger = NullLogger.Instance;
            T      = NullLocalizer.Instance;
        }
Exemple #3
0
 /// <summary>
 /// Tries to get the cache entry, if none is present, tries to acquire a lock on the entry so any other process simultaneously requesting the entry
 /// has to wait.
 /// </summary>
 /// <typeparam name="TResult">Type of the computation's result</typeparam>
 /// <param name="key">Key for the cache entry</param>
 /// <param name="acquire">Delegate for acquiring the cache entry</param>
 /// <param name="fallback">If the lock couldn't be acquired and the process timed out, this delegate will be run</param>
 /// <returns>Result of either the acquire or the fallback delegate</returns>
 public static TResult Get <TResult>(this ILockingCacheManager lockingCacheManager, string key, Func <AcquireContext <string>, TResult> acquire, Func <TResult> fallback)
 {
     return(lockingCacheManager.Get(key, acquire, fallback, new TimeSpan(0, 0, 4)));
 }