public StoreSnapshots(IStoreEvents store, IStreamCache cache, bool shouldCache, StreamIdGenerator streamGen) { _store = store; _cache = cache; _shouldCache = shouldCache; _streamGen = streamGen; }
public GlobalInfoProvider(ImageflowMiddlewareOptions options, IWebHostEnvironment env, ILogger <ImageflowMiddleware> logger, IStreamCache streamCache, IClassicDiskCache diskCache, IList <IBlobProvider> blobProviders) { this.env = env; this.streamCache = streamCache; this.options = options; var plugins = new List <object>() { logger, streamCache, diskCache }.Concat(blobProviders).ToList(); infoProviders = plugins.OfType <IInfoProvider>().ToList(); pluginNames = plugins .Where(p => p != null) .Select(p => { var t = p.GetType(); if (t.Namespace != null && (t.Namespace.StartsWith("Imazen") || t.Namespace.StartsWith("Imageflow") || t.Namespace.StartsWith("Microsoft.Extensions.Logging") || t.Namespace.StartsWith("Microsoft.Extensions.Caching"))) { return(t.Name); } else { return(t.FullName); } }).ToList(); }
public StoreStreams(IStoreEvents store, IStreamCache cache, bool cacheStreams, StreamIdGenerator streamGen) { _store = store; _cache = cache; _shouldCache = cacheStreams; _streamGen = streamGen; }
/// <summary> /// Creates a new serializer. /// </summary> protected RTreeStreamSerializer() { _streamCache = new MemoryCachedStream(); _cachedLeaves = new LRUCache <long, KeyValuePair <List <BoxF2D>, List <T> > >(10); _cachedIndexes = new LRUCache <long, KeyValuePair <ChildrenIndex, long> >(10); }
public StoreSnapshots(IEventStoreConnection client, ReadOnlySettings nsbSettings, IStreamCache cache, JsonSerializerSettings settings) { _client = client; _nsbSettings = nsbSettings; _settings = settings; _cache = cache; _shouldCache = _nsbSettings.Get <Boolean>("ShouldCacheEntities"); }
/// <summary> /// Asynchronously sets a stream in the specified cache with the specified key. /// </summary> /// <param name="cache">The cache in which to store the data.</param> /// <param name="key">The key to store the data in.</param> /// <param name="value">The data to store in the cache.</param> /// <param name="token">Optional. A <see cref="CancellationToken" /> to cancel the operation.</param> /// <returns>A task that represents the asynchronous set operation.</returns> /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="key"/> or <paramref name="value"/> is null.</exception> public static Task SetAsync(this IStreamCache cache, string key, IOStream value, CancellationToken token = default) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(cache.SetAsync(key, value, new StreamCacheEntryOptions(), token)); }
/// <summary> /// Sets a stream in the specified cache with the specified key. /// </summary> /// <param name="cache">The cache in which to store the data.</param> /// <param name="key">The key to store the data in.</param> /// <param name="value">The data to store in the cache.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="key"/> or <paramref name="value"/> is null.</exception> public static void Set(this IStreamCache cache, string key, IOStream value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } cache.Set(key, value, new StreamCacheEntryOptions()); }
/// <summary> /// Gets or creates an instant data target to be notified when new data for a stream is available. /// </summary> /// <typeparam name="TStreamData">The type of data in the stream.</typeparam> /// <typeparam name="TTarget">The type of data the instant visualization object requires.</typeparam> /// <param name="target">An instant data target that specifies the stream binding, the cursor epsilon, and the callback to call when new data is available.</param> /// <param name="viewRange">The initial time range over which data is expected.</param> internal void GetOrCreateStreamCache <TStreamData, TTarget>(InstantDataTarget target, TimeInterval viewRange) { // Get the stream reader. Note that we don't care about the stream reader's stream adapter // because with instant data we always read raw data and adapt the stream later. IStreamCache streamCache = this.GetOrCreateStreamCacheByName <TStreamData>(target.StreamName, null); // Register the target with the stream reader streamCache.RegisterInstantDataTarget <TTarget>(target, viewRange); }
internal DiagnosticsPage(ImageflowMiddlewareOptions options, IWebHostEnvironment env, ILogger <ImageflowMiddleware> logger, IStreamCache streamCache, IClassicDiskCache diskCache, IList <IBlobProvider> blobProviders) { this.options = options; this.env = env; this.streamCache = streamCache; this.diskCache = diskCache; this.blobProviders = blobProviders; }
public StoreEvents(IEventStoreConnection client, IBuilder builder, IMessageMapper mapper, IStoreSnapshots snapshots, ReadOnlySettings nsbSettings, IStreamCache cache) { _client = client; _mapper = mapper; _snapshots = snapshots; _nsbSettings = nsbSettings; _builder = builder; _cache = cache; _shouldCache = _nsbSettings.Get <Boolean>("ShouldCacheEntities"); }
public DomainSubscriber(IBuilder builder, IEventStoreConnection client, IDispatcher dispatcher, IStreamCache cache, ReadOnlySettings settings, IMessageMapper mapper) { _builder = builder; _client = client; _dispatcher = dispatcher; _cache = cache; _settings = settings; _jsonSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, Binder = new EventSerializationBinder(mapper), ContractResolver = new EventContractResolver(mapper) }; }
public HybridCacheHostedServiceProxy(IStreamCache cache) { this.cache = cache; }
public ImageflowMiddleware( RequestDelegate next, IWebHostEnvironment env, IEnumerable <ILogger <ImageflowMiddleware> > logger, IEnumerable <IClassicDiskCache> diskCaches, IEnumerable <IStreamCache> streamCaches, IEnumerable <IBlobProvider> blobProviders, ImageflowMiddlewareOptions options) { this.next = next; options.Licensing ??= new Licensing(LicenseManagerSingleton.GetOrCreateSingleton( "imageflow_", new[] { env.ContentRootPath, Path.GetTempPath() })); this.options = options; this.env = env; this.logger = logger.FirstOrDefault(); diskCache = diskCaches.FirstOrDefault(); var streamCacheArray = streamCaches.ToArray(); if (streamCacheArray.Count() > 1) { throw new InvalidOperationException("Only 1 IStreamCache instance can be registered at a time"); } streamCache = streamCacheArray.FirstOrDefault(); var providers = blobProviders.ToList(); var mappedPaths = options.MappedPaths.ToList(); if (options.MapWebRoot) { if (this.env?.WebRootPath == null) { throw new InvalidOperationException("Cannot call MapWebRoot if env.WebRootPath is null"); } mappedPaths.Add(new PathMapping("/", this.env.WebRootPath)); } //Determine the active cache backend var streamCacheEnabled = streamCache != null && options.AllowCaching; var diskCacheEnabled = this.diskCache != null && options.AllowDiskCaching; if (streamCacheEnabled) { options.ActiveCacheBackend = CacheBackend.StreamCache; } else if (diskCacheEnabled) { options.ActiveCacheBackend = CacheBackend.ClassicDiskCache; } else { options.ActiveCacheBackend = CacheBackend.NoCache; } options.Licensing.Initialize(this.options); blobProvider = new BlobProvider(providers, mappedPaths); diagnosticsPage = new DiagnosticsPage(options, env, this.logger, streamCache, this.diskCache, providers); licensePage = new LicensePage(options); globalInfoProvider = new GlobalInfoProvider(options, env, this.logger, streamCache, this.diskCache, providers); options.Licensing.FireHeartbeat(); GlobalPerf.Singleton.SetInfoProviders(new List <IInfoProvider>() { globalInfoProvider }); }
/// <summary> /// Initializes a new instance of the <see cref="HttpCachedClient"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <exception cref="ArgumentNullException">cache</exception> public HttpCachedClient(IStreamCache cache) : base() => Cache = cache ?? throw new ArgumentNullException(nameof(cache));