Developer forum

Forum » Development » Entire page cache and querystrings

Entire page cache and querystrings

Mikkel Høst
Reply

Hi.

I'm trying to solve a issue where we use the "entire page" cache feature in DW. This works really well in this usecase, because there are ALOT of products on the page. But now i'm trying to make the page a bit more "SPA" like - and therefor uses pushState to make pretty URL's and have state. The problem is when i reload a pushState link, DW doesn't uses the full page cache, because the URL is not the "same" i guess.

Are there anyway to get around this? Maybe a way for me telling DW when it can use the fullpage cache in terms of URL's and querystrings?

Any help would be great.


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Mikkel

My only idea is to use the # format in the URL - that should be disregarded by Dynamicweb and reload the cache.

Or create a second page where you populate your products using json and then make it truly async instead.

BR Nicolai

 
Mikkel Høst
Reply

Hi Nicolai.

Thank you for the answer, but this isn't a really good option for me right now. I have been looking a bit into the cache feature in Dynamicweb.dll. Dynamicweb.Frontend.PageView.Output().

It checks this if (this.CachePage && cache.CacheValid())
        {
            text = cache.GetCache();
            this.StatusText.Append(" <Page from cache> ");
        }

I guess that DW never get to this code, when it encounters a querystring on the given page. But it i could somehow "hack" this - so i could tell it just to get the pages from the cache anyway?

Any suggetions? Do you maybe know where to look or where DW decides that it should not do this when querystrings are on the cached paged?

 

 
Nicolai Høeg Pedersen
Reply

Hi Mikkel

No, DW never gets to that caode, because it will never cache if there are anything else than ?ID=123 in the querystring. So moving to hashbang format instead for your JS instead is the only option.

Alternatively, you can in your default.aspx get rid of the PageViewControl and simply load the pageview your self - and then intercept the PageView.Output() method and do it your self. But that is 'risky' business.

 
Mikkel Høst
Reply

Hi Nicolai.

Okay,that acutally sounds like something i could do. Anyway, the reason is that im moving away from the hashbang is that google now supports crawling and indexing with javascript on - but they will only index a page if you use the history.PushState API. EG- you get freindly URLs and no hashbang.. So i can't solve the indexing problem. Anyway a feature request here could be a new cache option "Entire page - ignore querysting" - This would be a good cache option if we want to build more "SPA" like solutions where we need to keep state in the URL with history.pushState and still be able to get the pages index'ed by google AND have a fast initial pageload with entire pagecache..

 

You must be logged in to post in the forum