Example #1
0
 /// <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));
 }
Example #2
0
 /// <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);
 }
Example #3
0
 /// <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));
 }
Example #4
0
        /// <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));
        }
Example #5
0
 /// <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));
 }