/// <summary>
        /// Initialize the cache
        /// </summary>
        protected void InitializeCache()
        {
            // WE LOAD FIXED REDIRECTS UP TO CACHE SIZE
            _CustomUrls = new KeyedCustomUrlCollection();
            CustomUrlCollection tempCustomUrls = CustomUrlDataSource.LoadForStore(this._CacheSize, 0);

            foreach (CustomUrl item in tempCustomUrls)
            {
                _CustomUrls.Add(item);
            }
            _CustomUrlCount = CustomUrlDataSource.CountForStore();
            _ValidCache     = true;
        }
        public static CustomUrlCollection LoadForStore(int maximumRows, int startRowIndex, string sortExpression)
        {
            int storeId = Token.Instance.StoreId;
            //CREATE THE DYNAMIC SQL TO LOAD OBJECT
            StringBuilder selectQuery = new StringBuilder();

            selectQuery.Append("SELECT");
            if (maximumRows > 0)
            {
                selectQuery.Append(" TOP " + (startRowIndex + maximumRows).ToString());
            }
            selectQuery.Append(" " + CustomUrl.GetColumnNames(string.Empty));
            selectQuery.Append(" FROM ac_CustomUrls");
            selectQuery.Append(" WHERE StoreId = @storeId");
            if (!string.IsNullOrEmpty(sortExpression))
            {
                selectQuery.Append(" ORDER BY " + sortExpression);
            }
            Database  database      = Token.Instance.Database;
            DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString());

            database.AddInParameter(selectCommand, "@storeId", System.Data.DbType.Int32, storeId);
            //EXECUTE THE COMMAND
            CustomUrlCollection results = new CustomUrlCollection();
            int thisIndex = 0;
            int rowCount  = 0;

            using (IDataReader dr = database.ExecuteReader(selectCommand))
            {
                while (dr.Read() && ((maximumRows < 1) || (rowCount < maximumRows)))
                {
                    if (thisIndex >= startRowIndex)
                    {
                        CustomUrl customUrl = new CustomUrl();
                        CustomUrl.LoadDataReader(customUrl, dr);
                        results.Add(customUrl);
                        rowCount++;
                    }
                    thisIndex++;
                }
                dr.Close();
            }
            return(results);
        }