本文整理汇总了C#中CacheType类的典型用法代码示例。如果您正苦于以下问题:C# CacheType类的具体用法?C# CacheType怎么用?C# CacheType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CacheType类属于命名空间,在下文中一共展示了CacheType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Cache
public static void Cache(Product product, CacheType cacheType)
{
if (!string.IsNullOrEmpty(product.UPC)
&& !upcProductDic.ContainsKey(product.UPC))
{
upcProductDic.Add(product.UPC, new ProductWraper()
{
CacheType = cacheType,
Product = product,
LastUsedTime = DateTime.Now
});
}
if (!string.IsNullOrEmpty(product.AmazonASIN)
&& !amazonAsinProductDic.ContainsKey(product.AmazonASIN))
{
amazonAsinProductDic.Add(product.AmazonASIN, new ProductWraper()
{
CacheType = cacheType,
Product = product,
LastUsedTime = DateTime.Now
});
}
if (!string.IsNullOrEmpty(product.BestBuySKU)
&& !bestBuySkuProductDic.ContainsKey(product.BestBuySKU))
{
bestBuySkuProductDic.Add(product.BestBuySKU, new ProductWraper()
{
CacheType = cacheType,
Product = product,
LastUsedTime = DateTime.Now
});
}
}
开发者ID:jimji2008,项目名称:ProcutVS,代码行数:35,代码来源:ProductPool.cs
示例2: SchemaTable
/// <summary>
///
/// </summary>
/// <param name="accessLevel">访问级别</param>
/// <param name="cacheType">缓存的类型</param>
/// <param name="isStoreInDb">是否存储到DB</param>
public SchemaTable(AccessLevel accessLevel, CacheType cacheType, bool isStoreInDb)
{
AccessLevel = accessLevel;
CacheType = cacheType;
Keys = new string[0];
_columns = new ConcurrentDictionary<string, SchemaColumn>();
}
开发者ID:LeeWangyeol,项目名称:Scut,代码行数:13,代码来源:SchemaTable.cs
示例3: GetItem
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static Object GetItem(CacheType type)
{
switch (type)
{
case CacheType.TopCatalog:
if (QJVRMSCache.Get(type.ToString()) == null)
{
QJVRMSCache.Insert(type.ToString(), Catalog.GetTopCatalog());
}
break;
case CacheType.AllCatalog:
if (QJVRMSCache.Get(type.ToString()) == null)
{
QJVRMSCache.Insert(type.ToString(), Catalog.GetAllCatalog());
}
break;
case CacheType.Feature:
break;
case CacheType.ResouceType:
if (QJVRMSCache.Get(type.ToString()) == null)
{
QJVRMSCache.Insert(type.ToString(), ResourceTypeManager.GetTypeList());
}
break;
default:
break;
}
return QJVRMSCache.Get(type.ToString());
}
开发者ID:rongcheng,项目名称:benz,代码行数:36,代码来源:CacheManager.cs
示例4: CacheSettings
public TimeSpan SlidingExpritationPeriod { get; set; } // Has sense for AspNet/Mixed cache
public CacheSettings(CacheType cacheType)
{
CacheType = cacheType;
SlidingExpritationPeriod = TimeSpan.Zero;
DefaultPriority = CachePriority.Default;
Size = -1; // Unlimited
}
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:9,代码来源:CacheSettings.cs
示例5: SaveCache
public async Task<bool> SaveCache(string stringToStore, CacheType type)
{
var fileName = type.GetFileNameFromCacheType();
try
{
StorageFile file;
// Check if file exist in local folder and if it does replace it
// C:\Users\three\AppData\Local\Packages\c49b095b-93a9-472f-a151-0629a4c64267_a9ekxv88vhe1y\LocalState
if (type == CacheType.SettingsData)
{
file = await LocalRoamingFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
}
else
{
file = await LocalCacheFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
}
// Write file to folder
await FileIO.WriteTextAsync(file, stringToStore);
return true;
}
catch
{
return false;
}
}
开发者ID:threezool,项目名称:LaunchPal,代码行数:29,代码来源:StorageManagerImplementation.cs
示例6: CachedItem
public CachedItem(object value, CacheType cacheType, TimeSpan increment)
{
Value = value;
CacheType = cacheType;
Increment = increment;
if (cacheType.IsDefined())
{ Expiration = DateTime.Now.Add(increment); }
}
开发者ID:onesimoh,项目名称:Andamio,代码行数:8,代码来源:CacheItem..cs
示例7: Invalidate
/// <summary>
/// Invalidate the image corresponding to given parameters from given caches.
/// </summary>
/// <param name="parameters">Image parameters.</param>
/// <param name="cacheType">Cache type.</param>
public static void Invalidate(this TaskParameter parameters, CacheType cacheType)
{
using (var task = CreateTask(parameters, null))
{
var key = task.GetKey();
ImageService.Invalidate(key, cacheType);
}
}
开发者ID:Sohojoe,项目名称:FFImageLoading,代码行数:13,代码来源:TaskParameterExtensions.cs
示例8: InvalidateAsync
/// <summary>
/// Invalidate the image corresponding to given parameters from given caches.
/// </summary>
/// <param name="parameters">Image parameters.</param>
/// <param name="cacheType">Cache type.</param>
public static async Task InvalidateAsync(this TaskParameter parameters, CacheType cacheType)
{
var target = new Target<WriteableBitmap, ImageLoaderTask>();
using (var task = CreateTask(parameters, target))
{
var key = task.GetKey();
await ImageService.Instance.InvalidateCacheEntryAsync(key, cacheType).ConfigureAwait(false);
}
}
开发者ID:CaLxCyMru,项目名称:FFImageLoading,代码行数:14,代码来源:TaskParameterExtensions.cs
示例9: CacheInstance
public static ICacheService CacheInstance(CacheType cacheType)
{
switch (cacheType)
{
case CacheType.LocalMemory:
return new LocalMemoryCacheService();
default:
throw new ArgumentException("Invalid cache type or cache type does not have implementation");
}
}
开发者ID:RabidDog,项目名称:csharp-cacheservice,代码行数:10,代码来源:CacheServiceFactory.cs
示例10: CacheMap
/// <summary>
/// Returns a caching map for the given input map.
/// </summary>
internal static IZoneIntervalMap CacheMap([NotNull] IZoneIntervalMap map, CacheType type)
{
switch (type)
{
case CacheType.Hashtable:
return new HashArrayCache(map);
default:
throw new ArgumentException("The type parameter is invalid", "type");
}
}
开发者ID:KonstantinDavidov,项目名称:nodatime,代码行数:13,代码来源:CachingZoneIntervalMap.cs
示例11: CacheCommandLogEntry
public CacheCommandLogEntry(OperationContext context, string commandName, object[] args, DateTime dateTime, long executionTime, int rowCount, CacheType cacheType)
: base(LogEntryType.Command, context, dateTime)
{
_commandName = commandName;
_args = args;
_dateTime = dateTime;
_executionTime = executionTime;
_rowCount = rowCount;
_cacheType = cacheType;
}
开发者ID:yuanfei05,项目名称:vita,代码行数:10,代码来源:CacheCommandLogEntry.cs
示例12: AddCachedTypes
public void AddCachedTypes(CacheType cacheType, params Type[] entities)
{
if(entities == null || entities.Length == 0)
return;
switch(cacheType) {
case CacheType.None: break;
case CacheType.LocalSparse: this.LocalSparseCacheTypes.UnionWith(entities); break;
case CacheType.Sparse: this.SparseCacheTypes.UnionWith(entities); break;
case CacheType.FullSet: this.FullSetCacheTypes.UnionWith(entities); break;
}
}
开发者ID:yuanfei05,项目名称:vita,代码行数:11,代码来源:CacheSettings.cs
示例13: CacheItemSet
/// <summary>
///
/// </summary>
/// <param name="cacheItemType"></param>
/// <param name="periodTime"></param>
/// <param name="isReadOnly"></param>
public CacheItemSet(CacheType cacheItemType, int periodTime, bool isReadOnly)
{
LoadingStatus = LoadingStatus.None;
_cacheItemType = cacheItemType;
_isReadOnly = isReadOnly;
if (periodTime > 0)
{
_period = new CachePeriod(periodTime);
}
}
开发者ID:GamesDesignArt,项目名称:UniversalCommon,代码行数:17,代码来源:CacheItemSet.cs
示例14: Extensions
public void Extensions(CacheType cacheType)
{
var cache = GetCache(cacheType, 3);
cache.Add(1, 10);
cache.Add(2, 20);
cache.Add(3, 30);
Assert.AreEqual(10, cache.Get(1));
Assert.AreEqual(20, cache.Get(2));
Assert.AreEqual(30, cache.Get(3));
}
开发者ID:juliolins,项目名称:interview,代码行数:12,代码来源:Cache.UT.cs
示例15: Basic
public void Basic(CacheType cacheType)
{
var cache = GetCache(cacheType, 3);
cache[1] = 10;
cache[2] = 20;
cache[3] = 30;
Assert.AreEqual(10, cache[1]);
Assert.AreEqual(20, cache[2]);
Assert.AreEqual(30, cache[3]);
}
开发者ID:juliolins,项目名称:interview,代码行数:12,代码来源:Cache.UT.cs
示例16: GetByAmazonASIN
public static Product GetByAmazonASIN(string ASIN, CacheType cacheType)
{
ProductWrapper cachedProductWrapper = (ProductWrapper)HttpRuntime.Cache.Get(GetCacheKeyForAmazonASIN(ASIN));
if (cachedProductWrapper == null
|| cacheType > cachedProductWrapper.CacheType)
{
cachedProductWrapper = Cache(GetAFilledProductByAmazonASIN(ASIN, cacheType), cacheType);
}
return cachedProductWrapper.Product;
}
开发者ID:jimji2008,项目名称:ProcutVS,代码行数:12,代码来源:ProductPool.cs
示例17: Put
public static void Put(CacheType typeOfCache, Object cacheItem)
{
TimeSpan expiry;
switch (typeOfCache) // handle the expiry according to the type of cache
{
default:
expiry = new TimeSpan(12, 0, 0);
break;
}
Put(KeyName(typeOfCache), cacheItem, expiry);
}
开发者ID:Exclr8,项目名称:CloudCore,代码行数:12,代码来源:cache.cs
示例18: GetByAmazonASIN
public static Product GetByAmazonASIN(string ASIN, CacheType cacheType)
{
Product product = null;
if (!amazonAsinProductDic.ContainsKey(ASIN)
|| (cacheType == CacheType.Full && amazonAsinProductDic[ASIN].CacheType == CacheType.Simple))
product = GetAFilledProductByAmazonASIN(ASIN, cacheType);
else
product = amazonAsinProductDic[ASIN].Product;
return product;
}
开发者ID:jimji2008,项目名称:ProcutVS,代码行数:12,代码来源:ProductPool.cs
示例19: DownloadBytesAndCacheAsync
private async Task<byte[]> DownloadBytesAndCacheAsync(string url, string filename, string filepath, CancellationToken token, TimeSpan? duration, CacheType? cacheType)
{
var responseBytes = await DownloadAsync(url, filename, token).ConfigureAwait(false);
if (responseBytes == null)
return null;
var allowDiskCaching = AllowDiskCaching(cacheType);
if (allowDiskCaching)
{
await _diskCache.AddToSavingQueueIfNotExistsAsync(filename, responseBytes, duration ?? new TimeSpan(30, 0, 0, 0)); // by default we cache data 30 days)
}
return responseBytes;
}
开发者ID:CaLxCyMru,项目名称:FFImageLoading,代码行数:14,代码来源:DownloadCache.cs
示例20: CreateMessage
public BrokeredMessage CreateMessage(string body, string queue, string messageType, CacheType cacheType, string filename)
{
var location = FullFilename(messageType, queue, filename);
var sasUri = TokenGenerator.GetBlobSasUri(_container, location);
CloudBlockBlob blockBlob = SaveToStorage(body, location);
LargeMessage myRefMsg = new LargeMessage
{
Uri = blockBlob.Uri,
BodyLocation = blockBlob.Name,
CacheType = CacheType.Storage,
SasUri = new Uri(sasUri)
};
return new BrokeredMessage(SerializationHelper.SerializeToJsonString(myRefMsg));
}
开发者ID:iremmats,项目名称:sb-largemessage,代码行数:14,代码来源:ReferenceMessage.cs
注:本文中的CacheType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论