This project has moved and is read-only. For the latest updates, please go here.

Question from Peter Donker about cache and url clashing

May 19, 2013 at 1:51 PM
So I've begun playing with this. I'm somewhat new to the whole friendly url thing. So let me get this straight. Upon application start you go round all installed providers and ask them "give me a list of url rules" and you cache those, right? I noticed you set the cache by hand to 20 mins. I believe the preferred practice is to just let DNN decide the cache timeout. But that's not important right now. What I'd like to know is how you'd deal with situations where you get clashes. I.e. a product name is the same as a category name, for instance. Or two modules use CatId. Is this method able to keep those apart?
May 19, 2013 at 2:02 PM
1) Upon application start you go round all installed providers and ask them "give me a list of url rules" and you cache those, right?
Yes
2) I noticed you set the cache by hand to 20 mins.
No, in version 0.1 its infinite cache. You have to clear cache by hand (Tools, clear cache).
3) I believe the preferred practice is to just let DNN decide the cache timeout.
In version 0.2 (next version) , its depending on the host cache settings (between 20 min and 3 hours)
In version 0.2, there is also a automatic cache clearing depending on other modules cache clearing. So when for exemple dnn clear the internal tabs cache, the openurlrewriter cache is automatically cleared. This works also for modules witch internally use cache like Property Agent.
4) What I'd like to know is how you'd deal with situations where you get clashes. I.e. a product name is the same as a category name, for instance. Or two modules use CatId. Is this method able to keep those apart?
Each UrlRule have a scope defined by PortalId, CultureCode, TabId. (TabId scope is already there, but the logic is not yet implemented).
So you (the provider) can limit clashes to urls on one page.
But for category and product names from the same module on a page, it’s the responsibility of the provider not to generate duplicate urls.
I have also the idea to generate warning when this happens. And maybe also automatically alter the url by suffixing the url to make it unique.
It's also a little bit the responsability of the user not to create 2 pages with the same name or 2 products with the same name.
May 19, 2013 at 2:23 PM
Thanks for the answers Sacha.
Each UrlRule have a scope defined by PortalId, CultureCode, TabId. (TabId scope is already there, but the logic is not yet implemented).
OK. That sounds logical. One thing though. ModuleId is not necessarily 1-1 related to TabId. This is a complication of the DNN Framework. So a module can sit as copies on multiple pages. Ideally your solution should ask for a list of tab ids for each module content.
Peter
May 19, 2013 at 3:47 PM
Peter,

My idea was to keep the mapping table simple (a single table).

In the future, i want to optionaly make this table storeble in the database. So the Url Rewriter can remember all the url rules of the past and automaticaly redirect to the new url.

So, the provider developper have 2 possibilities :

1) not include the tabid -> more risk for url clashes
2) include all posible combinations of tabid/itemid in the url rules

Most of the times, having the same items of a module on différents pages is not good thing, because it create duplicate content. This is not good for SEO. More then one comination will be a exception, i think.

Sacha
May 20, 2013 at 10:09 AM
Thanks Sacha. I'm not going to push you on this. I know that just getting something to version 1 is already a big thing.

What I've done yesterday is to create a provider for the new blog module. So I need to keep up to speed with what you are changing so we can make sure when it releases everything works.

Best,
Peter