NOPCOMMERCe and SUPER FAST SPEED Cache

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 лет назад
What do y think about cache?
Why you don't use cache(aspx and other)
Do you have samples of cache?
or maybe which kind of cache recommended to use(i saw in cms only DAL cache)?
Maybe there are some bestpractice to use cache?
14 лет назад
??

I dont get it. NC i using Cache a lot. Almost all classes that is resonable to use cahe is using cache :).
14 лет назад
If you are using an older version of nopCommerce, caching was not implemented to it's full potential. However, in the latest release it is fully implemented and configurable so you can turn on/off caching for the entities that you wish.

Hope this helps,
Ben
14 лет назад
Yes, i wanted to ask why you don't use output cache?
13 лет назад
It's an old post but still actual :

I am testing output caching on
TodaysPoll.ascx
NewsList.ascx
BestSellers.ascx
CategoryNavigation.ascx
TopicPage.ascx
Topic.ascx
HomePageCategories.ascx
HomePageProducts.ascx

with this directive <%@ OutputCache Duration="3600" VaryByParam="none" %> to speed up my home page.
A little hack was needed in BindData method to avoid a null reference exception :
 if (ctrlBestSellers != null) //I add this condition because when control is in cache, his reference is null
            {
                ctrlBestSellers.Visible = SettingManager.GetSettingValueBoolean("Display.ShowBestsellersOnMainPage");
            }


idem for other controls in the same method.

Everything works, cache is active and correctly used, but I found absolutly no difference in response time... :(
With or without output cache, ExecutionTimer gives me 0,045s (average)

Perhaps ExecutionTimer is not the best way to measure this improvement.
Perhaps OutputCache is not efficient with nop
Perhaps I forgot something...
13 лет назад
Hello,
I'd like to add OutputCache to HeaderMenu.ascx in which I added a "complex" generated menu using jQuery SuperFishMenu (as in the back-end).
The ASP.NET cache mechanism works because my breakpoints are not called but I have a problem with jQuery: "jQuery is undefined" in jquery.superfishmenu.js.
Note that in my OnPreRender I added (as in MenuControl.ascx.cs):
BindJQuery();
string superFishMenu = CommonHelper.GetStoreLocation() + "Scripts/jquery.superfishmenu.js";
Page.ClientScript.RegisterClientScriptInclude(superFishMenu, superFishMenu);
Page.ClientScript.RegisterClientScriptBlock(GetType(), String.Format("{0}_sfmenu", ClientID), String.Format("$(document).ready(function(){{$('#{0}').superfish({{autoArrows:false,speed:'fast',delay:200}});}});", ClientID), true);

Thanks for your help :)
13 лет назад
zar wrote:
Hello,
I'd like to add OutputCache to HeaderMenu.ascx in which I added a "complex" generated menu using jQuery SuperFishMenu (as in the back-end).
The ASP.NET cache mechanism works because my breakpoints are not called but I have a problem with jQuery: "jQuery is undefined" in jquery.superfishmenu.js.
Note that in my OnPreRender I added (as in MenuControl.ascx.cs):
BindJQuery();
string superFishMenu = CommonHelper.GetStoreLocation() + "Scripts/jquery.superfishmenu.js";
Page.ClientScript.RegisterClientScriptInclude(superFishMenu, superFishMenu);
Page.ClientScript.RegisterClientScriptBlock(GetType(), String.Format("{0}_sfmenu", ClientID), String.Format("$(document).ready(function(){{$('#{0}').superfish({{autoArrows:false,speed:'fast',delay:200}});}});", ClientID), true);

Thanks for your help :)


you need to move BindJQuery(); at the end. it should be rendered above all js files. may be you want to have a look in html source and see if its rendering above jquery.superfishmenu.js
12 лет назад
Hello,
I'd like to add ASP.NET OutputCache to user controls for product and category.
For instance, I set :
<%@ OutputCache Duration="300" VaryByParam="ProductId" %>

in OneVariant.ascx
or
<%@ OutputCache Duration="300" VaryByParam="CategoryId" %>

in ProductsInLines1.ascx
Data bindings calls are saved for each element. Checked.
What do you think of this approach?
Did some of you try it ? Any problems?

Second issue:
How to handle the language?
Because everything depends on NopContext.Current.WorkingLanguage.LanguageId.
My "cache key" must be: "ProductId/CategoryId + NopContext.Current.WorkingLanguage.LanguageId".
Any idea?
Thanks.
12 лет назад
I'm interested, too.
12 лет назад
Meanwhile I found the solution.
You need to implement the following method in your Global.asax :
    public override string GetVaryByCustomString(HttpContext context, string custom)
    {
        string strKey = string.Empty;

        if (custom.ToLower().Contains("language"))
        {
            strKey += "-" + NopContext.Current.WorkingLanguage.LanguageId.ToString();
        }
        if (custom.ToLower().Contains("[...]"))
        {
            [...]
        }

        return strKey;
    }

And then use VaryByCustom="Language" in your modules.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.