Here are the examples of the csharp api class Microsoft.ApplicationServer.Caching.DataCache.Get(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
9 Examples
0
1. Example
Project: KonfDB
Source File: InRoleCacheStore.cs
Source File: InRoleCacheStore.cs
public override T Get<T>(string key) { string cacheKey = CreateUniqueKey<T>(key, typeof (T).Name); if (_cache.Get(cacheKey) != null) { return (T) _cache[cacheKey]; } return default(T); }
0
2. Example
Project: caching
Source File: AppFabricCache.cs
Source File: AppFabricCache.cs
protected override object GetInternal(string key) { return _cache.Get(key); }
0
3. Example
Project: Mantle
Source File: AzureManagedCacheClient.cs
Source File: AzureManagedCacheClient.cs
public T Get(string objectId) { objectId.Require("objectId"); var cachedObject = DataCache.Get(objectId); if (cachedObject == null) return default(T); return ((T) (cachedObject)); }
0
4. Example
Project: KonfDB
Source File: InRoleCacheStore.cs
Source File: InRoleCacheStore.cs
public override void Remove<T>(string key) { string cacheKey = CreateUniqueKey<T>(key, typeof (T).Name); if (_cache.Get(cacheKey) != null) { _cache.Remove(cacheKey); } }
0
5. Example
Project: KonfDB
Source File: InRoleCacheStore.cs
Source File: InRoleCacheStore.cs
public override T Get<T>(string key, Func<T> func, CachePolicy mode) { // If cache is not enabled if (!Enabled && mode == CachePolicy.ExpireAsPerConfig) return func(); // Cache is enabled, so check in cache T newObject; string region = typeof (T).Name; string cacheKey = CreateUniqueKey<T>(key, region); if (_cache.Get(cacheKey) != null) { CurrentContext.Default.Log.Debug("Got from cache :" + cacheKey); newObject = (T) _cache[cacheKey]; } else { newObject = func(); CurrentContext.Default.Log.Debug("Added to cache :" + cacheKey + " > " + Add(key, region, newObject, mode)); } return newObject; }
0
6. Example
Project: 20487-DevelopingWindowsAzureAndWebServices
Source File: LocationsController.cs
Source File: LocationsController.cs
public Location Get(int id) { Location location = null; // TODO: Place cache initialization here DataCacheFactory cacheFactory = new DataCacheFactory(); DataCache cache = cacheFactory.GetDefaultCache(); // TODO: Find the location entity in the cache string cacheKey = "location_" + id.ToString(); location = cache.Get(cacheKey) as Location; if (location == null) { using (TravelCompanionContext context = new TravelCompanionContext()) { var locations = from l in context.Locations where l.LocationId == id select l; location = locations.FirstOrDefault(); // TODO: Add the location to the cache cache.Put(cacheKey, location); } } return location; }
0
7. Example
Project: -INACTIVE-uWebshop-Core
Source File: AzureAppCacheTokenService.cs
Source File: AzureAppCacheTokenService.cs
public Guid GetToken() { var mycache = new DataCache(); var cacheObject = mycache.Get(CacheKey); if (cacheObject == null || string.IsNullOrEmpty(cacheObject.ToString())) return Guid.Empty; if (cacheObject is Guid) return (Guid) cacheObject; Guid result; if (Guid.TryParse(cacheObject.ToString(), out result)) return result; return Guid.Empty; }
0
8. Example
Project: BetterCMS
Source File: AppFabricCacheService.cs
Source File: AppFabricCacheService.cs
public T Get<T>(string key, TimeSpan expiration, Func<T> getCacheObjectDelegate) { bool updateRequired = false; T obj = default(T); try { object objectFromCache = Cache.Get(key.ToUpperInvariant()); if (objectFromCache != null && objectFromCache.GetType() == typeof(T)) { try { obj = (T)objectFromCache; } catch { // If cast is not successful then need to update it in cache with new object. updateRequired = true; } } else { updateRequired = true; } if (updateRequired && getCacheObjectDelegate != null) { obj = getCacheObjectDelegate(); Set(key, obj, expiration); } return obj; } catch (Exception ex) { string message = string.Format("Failed to get value from cache with key={0}. {1}", key, ex.Message); throw new CmsException(message, ex); } }
0
9. Example
Project: 20487-DevelopingWindowsAzureAndWebServices
Source File: FlightsController.cs
Source File: FlightsController.cs
public HttpResponseMessage Get(int source, int destination, /n ..... /n //View Source file for more details /n }