本文整理汇总了C#中ObjectCache类的典型用法代码示例。如果您正苦于以下问题:C# ObjectCache类的具体用法?C# ObjectCache怎么用?C# ObjectCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectCache类属于命名空间,在下文中一共展示了ObjectCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReflectionOnlyAssemblyLoader
public ReflectionOnlyAssemblyLoader(ObjectCache cache, IEnumerable<string> assemblyLocation)
{
this._cache = cache;
this._locations = assemblyLocation.ToArray();
this._loadedAssemblies = new HashSet<Assembly>();
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += this.OnFailedAssemblyResolve;
}
示例2: FilterContext
public FilterContext(ObjectCache cache, CompositionContainer container, FilterState state, params IAssetFilter[] filters)
{
this.Container = container;
this.Cache = cache;
this.State = state;
this._filters = filters;
}
示例3: ChannelAdvisorServicesFactory
public ChannelAdvisorServicesFactory( string developerKey, string developerPassword, ObjectCache cache, TimeSpan slidingCacheExpiration )
{
this._developerPassword = developerPassword;
this._developerKey = developerKey;
this._cache = cache;
this._slidingCacheExpiration = slidingCacheExpiration;
}
示例4: FilterContext
public FilterContext(ObjectCache cache, CompositionContainer container, IAssetResolver assetResolver, FilterState state)
{
this.Container = container;
this.Cache = cache;
this.AssetResolver = assetResolver;
this.State = state;
}
示例5: CacheUnorderedNeuralVectorProvider
public CacheUnorderedNeuralVectorProvider(IUnorderedNeuralVectorsProvider baseProvider, ObjectCache cache = null)
{
Contract.Requires(baseProvider != null);
BaseProvider = baseProvider;
this.cache = cache ?? MemoryCache.Default;
}
示例6: RegisterCacheInfrastructure
public static void RegisterCacheInfrastructure(IKernel kernel, ObjectCache cache, ICacheKeyRegistrationService cacheKeyRegistrationService)
{
kernel.Bind<ICacheKeyGenerationService>().To<CacheKeyGenerationService>();
kernel.Bind<ICacheKeyRegistrationService>().ToConstant(cacheKeyRegistrationService);
kernel.Bind<ObjectCache>().ToConstant(cache);
}
示例7: Index
public Index(File file, string name, BiosParameterBlock bpb, UpperCase upCase)
{
_file = file;
_name = name;
_bpb = bpb;
_isFileIndex = name == "$I30";
_blockCache = new ObjectCache<long, IndexBlock>();
_root = _file.GetStream(AttributeType.IndexRoot, _name).GetContent<IndexRoot>();
_comparer = _root.GetCollator(upCase);
using (Stream s = _file.OpenStream(AttributeType.IndexRoot, _name, FileAccess.Read))
{
byte[] buffer = Utilities.ReadFully(s, (int)s.Length);
_rootNode = new IndexNode(WriteRootNodeToDisk, 0, this, true, buffer, IndexRoot.HeaderOffset);
// Give the attribute some room to breathe, so long as it doesn't squeeze others out
// BROKEN, BROKEN, BROKEN - how to figure this out? Query at the point of adding entries to the root node?
_rootNode.TotalSpaceAvailable += _file.MftRecordFreeSpace(AttributeType.IndexRoot, _name) - 100;
}
if (_file.StreamExists(AttributeType.IndexAllocation, _name))
{
_indexStream = _file.OpenStream(AttributeType.IndexAllocation, _name, FileAccess.ReadWrite);
}
if (_file.StreamExists(AttributeType.Bitmap, _name))
{
_indexBitmap = new Bitmap(_file.OpenStream(AttributeType.Bitmap, _name, FileAccess.ReadWrite), long.MaxValue);
}
}
示例8: InternalSegmentStream
/// <summary>
/// Initializes a new instance of the <see cref="InternalSegmentStream"/> class.
/// </summary>
/// <param name="objectCache">The object cache.</param>
/// <param name="key">The key.</param>
/// <param name="segmentSize">Size of the segment.</param>
/// <param name="region">The region.</param>
public InternalSegmentStream(ObjectCache objectCache, string key, int segmentSize, string region)
{
_segmentSize = segmentSize;
_cache = objectCache;
_regionKey = new RegionKey { Key = key, Region = region };
_canRead = true;
_canWrite = true;
_canSeek = true;
}
示例9: CSharpCodeChecker
public CSharpCodeChecker(ObjectCache compiledCustomCheckersCache)
{
if (compiledCustomCheckersCache == null)
{
throw new ArgumentNullException(nameof(compiledCustomCheckersCache));
}
this.compiledCustomCheckersCache = compiledCustomCheckersCache;
}
示例10: NtfsFileSystem
/// <summary>
/// Creates a new instance from a stream.
/// </summary>
/// <param name="stream">The stream containing the NTFS file system</param>
public NtfsFileSystem(Stream stream)
: base(new NtfsOptions())
{
_context = new NtfsContext();
_context.RawStream = stream;
_context.Options = NtfsOptions;
_context.GetFileByIndex = GetFile;
_context.GetFileByRef = GetFile;
_context.GetDirectoryByRef = GetDirectory;
_context.GetDirectoryByIndex = GetDirectory;
_context.AllocateFile = AllocateFile;
_context.ForgetFile = ForgetFile;
_context.ReadOnly = !stream.CanWrite;
_fileCache = new ObjectCache<long, File>();
stream.Position = 0;
byte[] bytes = Utilities.ReadFully(stream, 512);
_context.BiosParameterBlock = BiosParameterBlock.FromBytes(bytes, 0);
// Bootstrap the Master File Table
_context.Mft = new MasterFileTable(_context);
File mftFile = new File(_context, _context.Mft.GetBootstrapRecord());
_fileCache[MasterFileTable.MftIndex] = mftFile;
_context.Mft.Initialize(mftFile);
// Initialize access to the other well-known metadata files
_context.ClusterBitmap = new ClusterBitmap(GetFile(MasterFileTable.BitmapIndex));
_context.AttributeDefinitions = new AttributeDefinitions(GetFile(MasterFileTable.AttrDefIndex));
_context.UpperCase = new UpperCase(GetFile(MasterFileTable.UpCaseIndex));
_context.SecurityDescriptors = new SecurityDescriptors(GetFile(MasterFileTable.SecureIndex));
_context.ObjectIds = new ObjectIds(GetFile(GetDirectoryEntry(@"$Extend\$ObjId").Reference));
_context.ReparsePoints = new ReparsePoints(GetFile(GetDirectoryEntry(@"$Extend\$Reparse").Reference));
_context.Quotas = new Quotas(GetFile(GetDirectoryEntry(@"$Extend\$Quota").Reference));
File volumeInfoFile = GetFile(MasterFileTable.VolumeIndex);
_volumeInfo = volumeInfoFile.GetStream(AttributeType.VolumeInformation, null).GetContent<VolumeInformation>();
#if false
byte[] buffer = new byte[1024];
for (int i = 0; i < buffer.Length; ++i)
{
buffer[i] = 0xFF;
}
using (Stream s = OpenFile("$LogFile", FileMode.Open, FileAccess.ReadWrite))
{
while (s.Position != s.Length)
{
s.Write(buffer, 0, (int)Math.Min(buffer.Length, s.Length - s.Position));
}
}
#endif
}
示例11: ObjectCacheAmbientContextManager
/// <summary>
/// Initializes a new instance of the <see cref="ObjectCacheAmbientContextManager" /> class.
/// </summary>
/// <param name="cache">The cache.</param>
/// <exception cref="System.ArgumentNullException">Thrown when <paramref name="cache"/> is null.</exception>
public ObjectCacheAmbientContextManager(ObjectCache cache)
{
if (cache == null)
{
throw new ArgumentNullException("cache");
}
_Cache = cache;
}
示例12: Reload
void Reload()
{
MemoryStream ms = new MemoryStream();
Cache.Save(ms);
ms.Position = 0;
Cache = new ObjectCache();
Cache.Load(ms);
}
示例13: RoutineManager
public RoutineManager(ITransaction transaction)
{
if (transaction == null)
throw new ArgumentNullException("transaction");
routinesCache = new ObjectCache<IRoutine>();
this.transaction = transaction;
this.transaction.Context.RouteImmediate<TransactionEvent>(OnTransactionEnd, e => e.EventType != TransactionEventType.Begin);
}
示例14: AutoChartingService
public AutoChartingService(ILogger logger,
IConfigurationService configurationService,
ITradeIdeasStorage tradeIdeasStorage,
ObjectCache cache)
{
_logger = logger;
_cache = cache;
_configurationService = configurationService;
_tradeIdeasStorage = tradeIdeasStorage;
}
示例15: CachedLifetime
public CachedLifetime(ObjectCache cache, CacheItemPolicy policy)
{
if (cache == null)
throw new ArgumentNullException("cache");
if (policy == null)
throw new ArgumentNullException("policy");
_cache = cache;
_cachePolicy = policy;
}