/// <summary> /// Gets one entity from the cache by its Id, only works for Singleton spawners with data templates(IEntities) /// </summary> /// <typeparam name="T">the type of the entity</typeparam> /// <param name="id">the id</param> /// <returns>the entity requested</returns> public static T Get <T>(string uniqueKey) where T : IConfigData { ConfigDataCacheKey key = new ConfigDataCacheKey(typeof(T), uniqueKey); return(Get <T>(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 object Get(ConfigDataCacheKey key) { return(BackingCache.Get(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(ConfigDataCacheKey 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 T Get <T>(ConfigDataCacheKey key) where T : IConfigData { return(BackingCache.Get <T>(key)); }
/// <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(ConfigDataCacheKey key) { BackingCache.Remove(key); }