public byte[] Get(DecryptIdentifier identifier) { var cacheKey = _cacheKeyGenerator.Generate(identifier); var cacheItem = _distributedCache.Get(cacheKey); return(cacheItem); }
public GenerateDataKeyResult Get(DataKeyIdentifier key) { var cacheKey = _cacheKeyGenerator.Generate(key); var cacheItem = _distributedCache.Get(cacheKey); if (cacheItem is null) { return(null); } return(_cacheValueConverter.Convert(cacheItem)); }
public override void Execute(ObjectConstructionArgs args) { var miniProfiler = _profiler as MiniProfiler; //if (miniProfiler == null || !miniProfiler.IsActive || miniProfiler.Options?.TrackConnectionOpenClose == false) if (miniProfiler == null) { _inner.Execute(args); return; } using (var timing = new CustomTiming(miniProfiler, "ConstructionTimerStart Execute()", _debugSettings.SlowModelThreshold)) { var stopwatch = new Stopwatch(); stopwatch.Start(); try { _inner.Execute(args); } finally { stopwatch.Stop(); if (stopwatch.ElapsedMilliseconds > _debugSettings.SlowModelThreshold) { var key = _cacheKeyGenerator.Generate(args) + "stopwatch"; var finaltType = args.Result.GetType(); timing.CommandString = string.Format("Slow Glass Model - Time: {0} Cachable: {1} Type: {2} Key: {3}", stopwatch.ElapsedMilliseconds, args.Configuration.Cachable, finaltType.FullName, key); } } } }
public override void Execute(ObjectConstructionArgs args) { var stopwatch = new Stopwatch(); stopwatch.Start(); try { base.Execute(args); } finally { stopwatch.Stop(); if (stopwatch.ElapsedMilliseconds > _debugSettings.SlowModelThreshold) { var key = _cacheKeyGenerator.Generate(args) + "stopwatch"; var finalTypeName = "NULL"; if (args.Result != null) { finalTypeName = args.Result.GetType().FullName; } _log.Warn("Slow Glass Model - Time: {0} Cachable: {1} Type: {2} Key: {3}".Formatted(stopwatch.ElapsedMilliseconds, args.Options.Cache.IsEnabled(), finalTypeName, key)); } } }
public void Execute(ObjectConstructionArgs args) { var key = _cacheKeyGenerator.Generate(args) + "stopwatch"; var stopwatch = new Stopwatch(); args.Parameters[key] = stopwatch; stopwatch.Start(); }
public byte[] Decrypt(byte[] ciphertextBlob, Dictionary <string, string> encryptionContext) { var key = _cacheKeyGenerator.Generate(ciphertextBlob, encryptionContext); var cacheItem = _distributedCache.Get(key); if (cacheItem is null) { var item = _keyManagementService.Decrypt(ciphertextBlob, encryptionContext); _distributedCache.Set(key, item); return(item); } return(cacheItem); }
public virtual void Execute(ObjectConstructionArgs args) { if (args.Result != null && args.Configuration.Cachable && DisableCache.Current == CacheSetting.Enabled && args.AbstractTypeCreationContext.CacheEnabled ) { var key = _cacheKeyGenerator.Generate(args); // This will also OVERRIDE any existing item that may already be cached (to be consistent across different cache impls) // Will allow for multiple threads to update the cached object on first load, when they are all racing to cache the item for the first time _cacheManager.AddOrUpdate(key, args.Result); } }
public virtual void Execute(ObjectConstructionArgs args) { if (args.Result == null && args.Configuration.Cachable && DisableCache.Current == CacheSetting.Enabled && args.AbstractTypeCreationContext.CacheEnabled ) { var key = _cacheKeyGenerator.Generate(args); var cacheItem = _cacheManager.Get <object>(key); if (cacheItem != null) { args.Result = cacheItem; args.AbortPipeline(); } } }
public void Execute(ObjectConstructionArgs args) { var key = _cacheKeyGenerator.Generate(args) + "stopwatch"; if (args.Parameters.ContainsKey(key)) { Stopwatch stopwatch = args.Parameters[key] as Stopwatch; args.Parameters.Remove(key); if (stopwatch != null) { stopwatch.Stop(); if (stopwatch.ElapsedMilliseconds > _debugSettings.SlowModelThreshold) { var finaltType = args.Result.GetType(); _log.Warn("Slow Glass Model - Time: {0} Cachable: {1} Type: {2} Key: {3}".Formatted(stopwatch.ElapsedMilliseconds, args.Configuration.Cachable, finaltType.FullName, key)); } } } }
private string KeyInternal(TId id) { var key = Key(id); return(CacheKeyGenerator.Generate <T>(key)); }