common caching mechanism for xfdesktop and xfce4-appfinder

Brian J. Tarricone bjt23 at
Thu May 12 21:08:43 CEST 2005

Hash: SHA1
Eduard Roccatello wrote:

> Hello devs! (and not :-)
> Some time ago we was talking about a common cache for .desktop
> files usable by every apps in xfce desktop suite. I'm thinking
> about rewriting the indexing mechanism of xfce4-appfinder widget
> (yeah i know... i haven't committed anything :o) ...but some things
> are broken and i need to fix before committing and obviously time
> lacks).
> So... ehm... what about the cache? :-) We need something abstract
> enough for everyday use.

1) It should be stored in an mmap()able file.  This means a binary
format, and the easiest way is probably to just design a struct which
is sized and populated using the least common denominator of
platform/compiler alignment rules.  This means wasting some disk space
and RAM, but that's really the whole point of a cache in the first
place: waste disk space and RAM to get performance.

2) It should be stored in host byte order for performance reasons.
This means that the cache file won't be shareable among platforms with
different byte orders.  However, we might be able to design around
this, as most .desktop data is string data.  Boolean values can be
treated as 32-bit integers such that TRUE=0xffffffff and FALSE=0x0.
This really needs some more thought and fleshing out.

3) Should it be a per-user or systemwide cache?  Or should there be
both?  Users can store .desktop files in
~/.local/share/applications/.  However, the systemwide cache shouldn't
change often.  But, there's no way to automatically regenerate the
systemwide cache, given that it would require root access.  So my
suggestion would be a per-user cache.  The downside is that multi-user
systems with more than one person running Xfce would end up having two
copies of the cache loaded into memory.  I don't think this is a
terribly common case, however.

4) Transparency.  I don't think we should bother if updating the cache
requires manual intervention.  That's a big step backward, IMHO.
However, updating it automatically it difficult.  If the cache is out
of date, how do we make sure only one app tries to update the cache?
How do we ensure that other apps mmap()ing the file don't get
corrupted data?

5) Should probably look what the fd.o folks are doing with the icon
theme cache - I'm sure we can reuse most (if not all) of their ideas.


Version: GnuPG v1.4.1 (MingW32)

More information about the Xfce4-dev mailing list