[webkit-dev] what's the difference between Cache and PageCache in WebCore?

Frédéric Lefebvre Frederic.Lefebvre at 4d.com
Wed Feb 16 02:50:07 PST 2011


I'm on a Webkit based app dev and faces too this important caching problem when reopening/reloading a document my interface edits.

A part of my view is a page I wish to be able to continue caching its elements, while the other part is a page I wish to change dynamically, using local/LAN resources.
For the moment, I don't set any specific caching policy except using the head metas for each, only trusting the creation/modification date of the files to be considered in cache/no-cache access.
But modified/added images are not correctly refreshed, some are well on reopening the dynamic part but not on reloading, the others do the whole contrary.

Looking for this strange <double>::max() return line in the CachedResource::freshnessLifetime() function, I found some identical problem happened to another coder (http://www.mail-archive.com/webkit-dev@lists.webkit.org/msg10532.html) in the "[webkit-dev] WebKit cache of non-http resources" thread.

So I come with two questions:
- What is the way, if any, to force -from out of WebCore context- the cachedResource of A dom/css/js element to flush?
- What is the way, if any, to punctually set an opened/modified page's back/forward origin to its present state without a whole flushing/reopen?
  (Ensuring it will return to this exact state after any contextual-reload or page reopening action, resetting the back/forward list to none but keeping the resources/page live)

Subsidiary question:
- Why this nonHTTP forced-caching policy implicitely including local files access (not a performance issue)?



Frédéric Lefebvre
Développeur Senior

60, rue d'Alsace
92110 Clichy

Téléphone : +33 1 40 87 92 74
Standard :  +33 1 40 87 92 00
Fax :       +33 1 40 87 92 01
Email :     Frederic.Lefebvre at 4d.com
Web :       www.4D.com


Aneesh Bhasin contact.aneesh at gmail.com


My answers inline...
PS : am keeping webkit-dev in the loop - this information may be
useful for others as well - or if I am wrong somewhere, others may
correct me..

2011/2/15 付文彬 <fuwenbin2086 at 126.com <http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev> >
> Thanks for your help!
>  I know the capacity of Resource Cache can be set according to method: Cache::setCapacities, but Page Cache can only  be set the number of pages in cache.
> Can you give me some suggestions for "limit the total memory used by Page Cache" ?

Yes, the page cache can only be set in terms of the number of pages-
due to the nature of data it stores, it will be difficult and
impractical to have a memory-size limit on it. Depending on the
content of page being stored in PAge Cache, the actual memory used
will vary.

> And you said  "low memory will come at an impact to the page-loading time." What does "page-loading time"  mean?

Imagine having the Page cache switched off - that means every time you
press the 'back' button, the HTML will be parsed,  DOM tree will again
have to be constructed followed by the usual process of attachement
etc. This will increase the time it takes to display the page onscreen
- this is the 'page loading time' penalty I was referring to in my
earlier mail. Similar argument will also apply to Resource Cache as

Hope that helps..


> At 2011-02-15 14:13:10,"Aneesh Bhasin" <contact.aneesh at gmail.com <http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev> > wrote:
> Hi,
> Here's my understanding on this : There are two types of caches in WebKit : Page Cache and Resource Cache.
> Resource Cache as the name suggests is to hold raw (e.g. CSS, JS etc.) as well as decoded (e.g images) resources so that sites which share these resources do not need to go to the network or even the network cache for these resources. Of course, it also saves time spent in decoding of images. You can limit the capacity (of complete cache as well as live and dead resources) or turn it off completely.
> The other is the Page Cache which holds all the data structres used for rendering the tree (DOM tree, render tree etc.) - used mainly to quickly display the page during forward/backward navigation. Again, you can limit the total memory used by this cache...
> Depending on your use-case, you can fiddle with the setting of these caches - of course, low memory will come at an impact to the page-loading time.
> Hope that helps..
> Regards,
> Aneesh
> 2011/2/15 付文彬 <fuwenbin2086 at 126.com <http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev> >
>> I want to reduce memory use of webkit,what can I do?
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org <http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev>
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

More information about the webkit-dev mailing list