/// <summary> /// Removes an entity from the cache by its key /// </summary> /// <param name="key">the key of the entity to remove</param> public static void Remove(PlayerDataCacheKey key) { BackingCache.Remove(key); }
/// <summary> /// Checks if an entity is in the cache /// </summary> /// <param name="key">the key of the entity</param> /// <returns>if it is in the cache of not</returns> public static bool Exists(PlayerDataCacheKey key) { return BackingCache.Exists(key); }
/// <summary> /// Gets one entity from the cache by its key /// </summary> /// <typeparam name="T">the type of the entity</typeparam> /// <param name="key">the key it was cached with</param> /// <returns>the entity requested</returns> public static ICharacter Get(PlayerDataCacheKey key) { EnsureAccountCharacters(key.AccountHandle); return BackingCache.Get<ICharacter>(key); }
/// <summary> /// Adds a single entity into the cache /// </summary> /// <param name="objectToCache">the entity to cache</param> public static void Add(ICharacter objectToCache) { var cacheKey = new PlayerDataCacheKey(typeof(ICharacter), objectToCache.AccountHandle, objectToCache.ID); BackingCache.Add(objectToCache, cacheKey); }
/// <summary> /// Checks if an entity is in the cache /// </summary> /// <param name="key">the key of the entity</param> /// <returns>if it is in the cache of not</returns> public static bool Exists(PlayerDataCacheKey key) { return(BackingCache.Exists(key)); }
/// <summary> /// Gets one entity from the cache by its key /// </summary> /// <typeparam name="T">the type of the entity</typeparam> /// <param name="key">the key it was cached with</param> /// <returns>the entity requested</returns> public static IPlayerTemplate Get(PlayerDataCacheKey key) { EnsureAccountCharacters(key.AccountHandle); return(BackingCache.Get <IPlayerTemplate>(key)); }
/// <summary> /// Adds a single entity into the cache /// </summary> /// <param name="objectToCache">the entity to cache</param> public static void Add(IPlayerTemplate objectToCache) { PlayerDataCacheKey cacheKey = new PlayerDataCacheKey(objectToCache); BackingCache.Add(objectToCache, cacheKey); }