Subject: [Instant-dev] Final cache behaviour changes

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Sun, 7 Sep 2008 23:26:29 +0200

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?

--
Martin

---

From: Anders Logg <[email-masked]>
Date: Sun, 7 Sep 2008 23:55:06 +0200

> 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

---

From: [email-masked]
Date: Mon, 8 Sep 2008 08:38:47 +0200 (CEST)

> Are everybody happy with this?

I'm happy.

Kent