[Fontconfig] Re: Structure of cache files

Keith Packard keithp at keithp.com
Wed Oct 5 11:59:05 EST 2005

On Tue, 2005-10-04 at 20:42 -0400, Patrick Lam wrote:
> Matthias Clasen wrote:
> >>Oops, you're right.  How about this: when we find that the cache is
> >>invalidated on any platform, we remove all stale sections from other
> >>platforms.  That ought to be sufficient to avoid staleness (safety).  Of
> >>course, an update to a file which is not stale preserves existing
> >>sections (liveness).  With this solution, in order to fully update cache
> >>files, you'll have to run fc-cache on all relevant platforms once, which
> >>is the best we can do (without cross-platform cache creation) anyway.
> > 
> > Sounds like it should work well enough (since fonts are not installed
> > with high frequency...)
> I just committed a patch which unlinks the file if it's stale; if it's
> not stale but just lacking a section, then it adds the section to the
> cache.  So I reverted the patch to FcDirCacheValid and added
> FcDirCacheHasCurrentArch.
> So, if FcDirCacheValid && FcDirCacheHasCurrentArch, then skip.
> Otherwise, !FcDirCacheValid || !FcDirCacheHasCurrentArch.  If
> !FcDirCacheValid (ie stale), then unlink.  In all cases, continue by
> saving the cache.

I think you need to copy the other architectures into the new file and
unlink the old one; there's no other way to avoid destroying existing
running applications images of the cache file.

Oh, would resetting the mod time on the cache file be useful in avoiding
thrashing among multiple architectures? By checking whether the existing
timestamp was "new enough", and re-using that value for the new file, we
would then just always use the cache file timestamp itself.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051004/9c934bea/attachment.pgp

More information about the Fontconfig mailing list