axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] caching getdatabase info


From: daly
Subject: [Axiom-developer] caching getdatabase info
Date: Tue, 10 Jun 2014 11:09:33 -0500

Ralf,

The getdatabase information is already cached.

If you look at the function getdatabase (line 37473 in bookvol5)
you'll see code groups that look like:

...
  (constructorkind
   (setq stream *interp-stream*)
   (when (setq struct (get constructor 'database))
     (setq data (database-constructorkind struct))))
...

Since we don't need no stinking comments (yet) the above code
handles a request for 

   (getdatabase domain 'constructorkind)

It sets the stream to read to the correct open daase file.
Then it checks the domain for 'database on the symbol-plist
(property list, an association list).

If the data is already in memory it will set 'struct to the data.

The database defstruct is defined in bookvol5 on line 36854, which
actually IS documented.

The 'struct is a common lisp defstruct, consisting of many fields,
one of which is the 'constructorkind field. Accessing a struct uses
the struct name followed by the field name, database-constructorkind

If the data returned is a number then we have not yet actually
fetched the real data, just a numeric index into the KAF file
(daase files are KAF files, Keyed-Access files, aka random access).

So if the data is numeric then we access the file to get the real
data, replace the numeric data with the real data in the cache with

      (constructorkind (setf (database-constructorkind struct) data)

Thus, the next call to 

   (getdatabase domain 'constructorkind)

will fetch the cached data from memory kept on the domain symbol.

Tim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]