A cache key for live entities
Inheritance: ICacheKey
コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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));
 }
コード例 #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);
 }
コード例 #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));
        }
コード例 #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);
        }