本文整理汇总了C#中CacheManager类的典型用法代码示例。如果您正苦于以下问题:C# CacheManager类的具体用法?C# CacheManager怎么用?C# CacheManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CacheManager类属于命名空间,在下文中一共展示了CacheManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppManager
public AppManager(IDataLayer dl)
{
data = dl;
cache = new CacheManager();
this.firstDataDate = DateTime.Now;
}
示例2: AssemblyExplorer
public AssemblyExplorer(MSpecUnitTestProvider provider,
#if RESHARPER_61
IUnitTestElementManager manager,
PsiModuleManager psiModuleManager,
CacheManager cacheManager,
#endif
IMetadataAssembly assembly,
IProject project,
UnitTestElementConsumer consumer)
{
_assembly = assembly;
_consumer = consumer;
using (ReadLockCookie.Create())
{
var projectEnvoy = new ProjectModelElementEnvoy(project);
var cache = new ContextCache();
#if RESHARPER_61
_contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, _assembly.Location.FullPath, cache);
_contextSpecificationFactory = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
_behaviorFactory = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
_behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy);
#else
#if RESHARPER_6
_contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location.FullPath, cache);
#else
_contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location, cache);
#endif
_contextSpecificationFactory = new ContextSpecificationFactory(provider, project, projectEnvoy, cache);
_behaviorFactory = new BehaviorFactory(provider, project, projectEnvoy, cache);
_behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project, projectEnvoy);
#endif
}
}
示例3: AmoebaManager
public AmoebaManager(string blocksPath, BufferManager bufferManager)
{
_blocksPath = blocksPath;
_bufferManager = bufferManager;
_clientManager = new ClientManager(_bufferManager);
_serverManager = new ServerManager(_bufferManager);
_cacheManager = new CacheManager(_blocksPath, _bufferManager);
_connectionsManager = new ConnectionsManager(_clientManager, _serverManager, _cacheManager, _bufferManager);
_downloadManager = new DownloadManager(_connectionsManager, _cacheManager, _bufferManager);
_uploadManager = new UploadManager(_connectionsManager, _cacheManager, _bufferManager);
_backgroundDownloadManager = new BackgroundDownloadManager(_connectionsManager, _cacheManager, _bufferManager);
_backgroundUploadManager = new BackgroundUploadManager(_connectionsManager, _cacheManager, _bufferManager);
_clientManager.CreateCapEvent = (object sender, string uri) =>
{
return _createCapEvent?.Invoke(this, uri);
};
_serverManager.AcceptCapEvent = (object sender, out string uri) =>
{
uri = null;
return _acceptCapEvent?.Invoke(this, out uri);
};
_clientManager.CheckUriEvent = (object sender, string uri) =>
{
return _checkUriEvent?.Invoke(this, uri) ?? true;
};
_serverManager.CheckUriEvent = (object sender, string uri) =>
{
return _checkUriEvent?.Invoke(this, uri) ?? true;
};
}
示例4: ItemBrowsingService
public ItemBrowsingService(IItemService itemService, ISearchProvider searchService, CacheManager cacheManager, IBlobUrlResolver blobUrlResolver = null, ISearchConnection searchConnection = null)
{
_searchProvider = searchService;
_searchConnection = searchConnection;
_itemService = itemService;
_blobUrlResolver = blobUrlResolver;
}
示例5: MSpecUnitTestProvider
public MSpecUnitTestProvider(ISolution solution, PsiModuleManager psiModuleManager, CacheManager cacheManager)
{
Solution = solution;
PsiModuleManager = psiModuleManager;
CacheManager = cacheManager;
Debug.Listeners.Add(new DefaultTraceListener());
}
示例6: XunitTestProvider
public XunitTestProvider(ISolution solution,
CacheManager cacheManager,
PsiModuleManager psiModuleManager,
UnitTestingCategoriesProvider categoriesProvider)
{
this.solution = solution;
}
示例7: Region
public Region( StatLog statLog, CacheManager cacheManager)
: base(0, 0, 0, 0)
{
// Store the statLog
_statLog = statLog;
// Store the cache manager
// TODO: What happens if the cachemanger changes during the lifecycle of this region?
_cacheManager = cacheManager;
//default options
options.Width = 1024;
options.Height = 768;
options.Left = 0;
options.Top = 0;
options.Uri = null;
this.Size = new Size(options.Width, options.Height);
this.Location = new Point(options.Left, options.Top);
this.Background = new SolidColorBrush(Colors.Red);
if (Settings.Default.DoubleBuffering)
{
// SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
// SetStyle(ControlStyles.AllPaintingInWmPaint, true);
}
// Create a new BlackList for us to use
blackList = new BlackList();
}
示例8: Init
public void Init(System.Web.HttpApplication context)
{
context.BeginRequest += Application_BeginRequest;
context.EndRequest += Application_EndRequest;
RootURL = System.Configuration.ConfigurationManager.AppSettings["ROOT_URL"];
if (string.IsNullOrEmpty(RootURL))
RootURL = "http://localhost";
MenCacheHost = System.Configuration.ConfigurationManager.AppSettings["MEMCACHE_HOST"];
if (string.IsNullOrEmpty(MenCacheHost))
MenCacheHost = "127.0.0.1:11211";
Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["ENABLED_MEMCACHE"], out MenCacheEnabled);
Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["ENABLED_WEBCACHE"], out WebCacheEnabled);
GetDespatch = new Despatch();
try
{
if (MenCacheEnabled)
MenCache = new CacheManager(MenCacheHost);
}
catch
{
}
}
示例9: ReadFromXml
public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
)
{
var projectId = parent.GetAttribute("projectId");
var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
if (project == null)
{
return null;
}
var behavior = parentElement as BehaviorElement;
if (behavior == null)
{
return null;
}
var typeName = parent.GetAttribute("typeName");
var methodName = parent.GetAttribute("methodName");
var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));
return BehaviorSpecificationFactory.GetOrCreateBehaviorSpecification(provider,
#if RESHARPER_61
manager, psiModuleManager, cacheManager,
#endif
project, behavior, ProjectModelElementEnvoy.Create(project), typeName, methodName, isIgnored);
}
示例10: GetOrCreateContextSpecification
public static ContextSpecificationElement GetOrCreateContextSpecification(MSpecUnitTestProvider provider,
IUnitTestElementManager manager,
PsiModuleManager psiModuleManager,
CacheManager cacheManager,
IProject project,
ContextElement context,
ProjectModelElementEnvoy projectEnvoy,
IClrTypeName declaringTypeName,
string fieldName,
bool isIgnored)
{
var id = ContextSpecificationElement.CreateId(context, fieldName);
var contextSpecification = manager.GetElementById(project, id) as ContextSpecificationElement;
if (contextSpecification != null)
{
contextSpecification.Parent = context;
contextSpecification.State = UnitTestElementState.Valid;
return contextSpecification;
}
return new ContextSpecificationElement(provider,
psiModuleManager,
cacheManager,
context,
projectEnvoy,
declaringTypeName,
fieldName,
isIgnored);
}
示例11: FileCollector
public FileCollector(CacheManager cacheManager, FilesModel xmlString)
{
_cacheManager = cacheManager;
// Create a required files object
_requiredFiles = new RequiredFiles();
foreach (var item in xmlString.Items)
{
_requiredFiles.Files.Add(item);
}
// Get the key for later use
hardwareKey = new HardwareKey();
// Make a new filelist collection
_files = new Collection<RequiredFileModel>();
// Create a webservice call
xmdsFile = new ServiceClient();
// Start up the Xmds Service Object
//xmdsFile.Credentials = null;
//xmdsFile.Url = Properties.Settings.Default.Client_xmds_xmds;
//xmdsFile.UseDefaultCredentials = false;
// Hook onto the xmds file complete event
xmdsFile.GetFileCompleted += (XmdsFileGetFileCompleted);
}
示例12: TestBasicCachingFunctionality
public void TestBasicCachingFunctionality()
{
string objectToStore = "Test Object";
CacheManager manager = new CacheManager(new MemoryProvider());
manager.Store(objectToStore);
Assert.AreEqual(objectToStore, manager.GetMostRecentCacheItem());
}
示例13: Example
public void Example()
{
var cacheManager = new CacheManager();
Assert.IsNotNull(cacheManager);
}
示例14: ReadFromXml
public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
)
{
var projectId = parent.GetAttribute("projectId");
var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
if (project == null)
{
return null;
}
var context = parentElement as ContextElement;
if (context == null)
{
return null;
}
var typeName = parent.GetAttribute("typeName");
var methodName = parent.GetAttribute("methodName");
var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));
return ContextSpecificationFactory.GetOrCreateContextSpecification(provider,
#if RESHARPER_61
manager, psiModuleManager, cacheManager,
#endif
project, context, ProjectModelElementEnvoy.Create(project), new ClrTypeName(typeName), methodName, EmptyArray<string>.Instance, isIgnored);
}
示例15: GetOrAddValueFactoryTest
public void GetOrAddValueFactoryTest()
{
var cacheManager = new CacheManager();
string key = "key" + DateTime.Now.Ticks;
object value = "value" + DateTime.Now.Ticks;
bool valueCalled = false;
Func<string, object> valueFactory = k => { valueCalled = true; return value; };
object result = cacheManager.GetOrAdd(key, valueFactory);
Assert.IsNotNull(result);
Assert.IsTrue(valueCalled);
Assert.AreEqual(value, result);
// value factory 2 should not be called
object value2 = "value2" + DateTime.Now.Ticks;
bool value2Called = false;
Func<string, object> valueFactory2 = k => { value2Called = true; return value2; };
object result2 = cacheManager.GetOrAdd(key, valueFactory2);
Assert.IsNotNull(result2);
Assert.IsFalse(value2Called);
// result should still = first call
Assert.AreEqual(value, result2);
}