← Back to team overview

instant team mailing list archive

Re: Final cache behaviour changes

 

On Sun, Sep 07, 2008 at 11:26:29PM +0200, Martin Sandve Alnæs wrote:
> I've implemented the new signature interpretation behaviour in
> import_module, but not checked in since build_module isn't quite
> updated yet. Will fix tomorrow morning.
> 
> The new behaviour is as follows:
> 
>   module = import_module(my_module_id[, my_cache_dir])
> 
> where my_module_id can be:
> - a non-string hashable object with a .signature() function that
> returns a string
> - a string
> 
> If mid = my_module_id is a non-string the memory cache is checked (a
> hashmap lookup).
> If not found the .signature() function is called upon: mid = mid.signature().
> 
> One way or another, now we have a string mid. Check if this is in the
> memory cache.
> 
> If mid is not a valid filename of less than 100 chars (this can be
> adjusted but should be constant),
> set mid = modulename_from_checksum(compute_checksum(mid)).
> Check if this is in the memory cache.
> 
> One way or another, now we have a string mid that is a valid filename.
> This is our module name.
> 
> Look for the module with name mid on disk in the current directory.
> Look for the module with name mid on disk in the cache directory.
> 
> Cache miss.
> 
> 
> Each time mid is changed, it is appended to a list of all previous module ids.
> When a module is found on disk and imported, it is added to the memory cache
> with each module id used.
> 
> 
> Are everybody happy with this?

This sounds good, but I'll have to try it out. I'll be away on a
workshop for a few days so I might not be able to check until later
this week.

-- 
Anders

Attachment: signature.asc
Description: Digital signature


References