See the class variable
_displayPageName? The variable that stores the value retrieved from the first non-null property of DisplayPageName and PageName. From reading that code, most readers would assume that the GetPropertyValue method is infrequently called.

Unfortunately, that is an incorrect assumption and the cache is practically useless. This is because the strongly typed PageData instances generated by PageTypeBuilder are never cached. Each time you get this page from the DataFactory, its class variables reset to their default values.

PageTypeBuilder hooks into Episerver CMS by attaching a handler to the DataFactory.Loaded*-events. Each time an untyped page is loaded from the cache, the LoadedPage event is fired and this line of code is executed:

C#

1

2

3

4

5

6

7

staticvoidDataFactory_LoadedPage(objectsender,PageEventArgse)

{

if(e.Page==null)

return;

e.Page=PageTypeResolver.Instance.ConvertToTyped(e.Page);

}

The returned page instance is a new instance, with its properties populated by a cached instance. In the best of circumstances, the cache would be operational only for the duration of one page view, but I doubt it even works that well.