[plt-scheme] maintaining a cached list of modules

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Fri May 8 06:23:47 EDT 2009

Jose A. Ortega Ruiz wrote at 05/07/2009 08:24 PM:
> I've just written a bit of Scheme code that traverses the collection
> directories and creates a list of available modules (so that i can get
> module path completion in emacs). Since it's a big list, i cache it; but
> now imagine that i require, say, a new PLaneT package in the same
> mzscheme session: my cache becomes stale. Is there any way of
> 'intercepting' calls to REQUIRE, or some other technique allowing me to
> keep the module list fresh?

I think it would be easiest and least intrusive to check the mtime on 
the parent directories on demand, to see if you need to rescan them to 
build your caches.

I think this will be fast enough to be imperceptible to an interactive user.

(Actually, building the list each time should be very fast on most 
subsequent builds, given that contemporary computers typically have 
enough RAM to cache directory info in RAM, so no disk I/O typically 
required.)

-- 
http://www.neilvandyke.org/


Posted on the users mailing list.