/// <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(TemplateCacheKey key) { return(BackingCache.Exists(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(TemplateCacheKey key) { BackingCache.Remove(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(TemplateCacheKey key) { return(BackingCache.Get(key)); }
/// <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>(long id) where T : IKeyedData { TemplateCacheKey key = new TemplateCacheKey(typeof(T), id); 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 T Get <T>(TemplateCacheKey key) where T : IKeyedData { return(BackingCache.Get <T>(key)); }