A cache key for live entities
Inheritance: ICacheKey
Exemplo n.º 1
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(PlayerDataCacheKey key)
 {
     BackingCache.Remove(key);
 }
Exemplo n.º 2
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(PlayerDataCacheKey key)
 {
     return BackingCache.Exists(key);
 }
Exemplo n.º 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 ICharacter Get(PlayerDataCacheKey key)
        {
            EnsureAccountCharacters(key.AccountHandle);

            return BackingCache.Get<ICharacter>(key);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
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(PlayerDataCacheKey key)
 {
     return(BackingCache.Exists(key));
 }
Exemplo n.º 6
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(PlayerDataCacheKey key)
 {
     BackingCache.Remove(key);
 }
Exemplo n.º 7
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 IPlayerTemplate Get(PlayerDataCacheKey key)
        {
            EnsureAccountCharacters(key.AccountHandle);

            return(BackingCache.Get <IPlayerTemplate>(key));
        }
Exemplo n.º 8
0
        /// <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);
        }