コード例 #1
0
    /// <summary>
    /// Clears the item's cache on it's current database.
    /// </summary>
    /// <param name="item">Item to remove from all the caches.</param>
    public static void ClearCache(this Item item)
    {
        var db = item.Database;

        // Clear item's Item Cache
        db.Caches.ItemCache.RemoveItem(item.ID);

        // Clear item's Data Cache
        db.Caches.DataCache.RemoveItemInformation(item.ID);

        // Clear item's Standard Value Cache
        db.Caches.StandardValuesCache.RemoveKeysContaining(item.ID.ToString());

        // Clear item's Prefetch Cache
        var sqlPrefetchCache = CacheManagerEx.GetSqlPrefetchCache(db.Name);

        if (sqlPrefetchCache != null)
        {
            sqlPrefetchCache.Remove(item);
        }
    }