1
0
mirror of synced 2026-01-12 00:42:56 +00:00
Interlisp.medley/library/Cash-File.tedit

92 lines
7.9 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1
Lisp Library Modules, Medley Release 1.0, CASH-FILE
1
Lisp Library Modules, Medley Release 1.0, CASH-FILE
CASH-FILE
1
CASH-FILE
1
CASH-FILE
6
Cash-File is a front end to Hash-File which uses a hash table to cache accesses to hash files. This can provide a significant performance improvement in applications which access a small number of keys repeatedly. For example, the Where-Is library module uses this module to achieve acceptable interactive performance.
Cash-File(CASH-FILE NIL Cash-File NIL NIL 15) is similar to but not compatible with the LispUsers' module, HASHBUFFER.
All of the code for Cash-File is in a package called Cash-File. Througout this document Lisp symbols are printed as though in a package which uses the packages Cash-File, Hash-File, and Lisp.
Installation
1
Load CASH-FILE.DFASL and HASH-FILE.DFASL from the library.
Functions
1
The functional interface is designed to closely resemble that of Hash-File, which was in turn designed to resemble the Common Lisp hash table facility.
(make-cash-file(MAKE-CASH-FILE (Function) make-cash-file NIL NIL 15) file-name size cache-size) [Function]
Creates and returns an empty cash file in file-name. Size is passed as the size argument to make-hash-file, while cache-size is passed as the size argument to make-hash-table and determines the maximum number of entries to be cached.
(get-cash-file(GET-CASH-FILE (Function) get-cash-file NIL NIL 15) key cash-file &optional default) [Function]
Just like get-hash-file and gethash. Retrieves the value stored under key in cash-file or default if there is none. Also returns a second value which is true if a value was found for key.
A setf method is also defined for get-cash-file .
(open-cash-file file-name cache-size &key direction) [Function]
Open the existing hash file in file-name in direction (:input or :io). Cache-size is passed as the size argument to make-hash-table and determines the maximum number of entries which will ever be cached.
(rem-cash-file key cash-file) [Function]
Like rem-hash-file and remhash. Deletes key from the hash file and the cache. Returns true if and only if there was a value stored under key.
(cash-file-p object) [Function]
Returns true if and only if object is a cash file.
(cash-file-p object)<29><> <20>r<EFBFBD>(typep object 'cash-file)
(cash-file-hash-file cash-file) [Function]
Returns the hash file object to which cash-file is a front end.
There are no cash file specific equivalents for close-hash-file, map-hash-file and hash-file-count. For these use the hash file functions on the cash-file-hash-file .
Implementation Notes
1
A queue is maintained to enable cache deletion when the cache is full. This queue is implemented as a list. Each time a key is accessed, it is moved to the head of the queue. The last element of the queue is deleted when a new key is accessed and the queue is full.
Limitations
1
The cache time is not constant but grows linearly with the size of the cache. For this reason, huge caches are not recommended.
[This page intentionally left blank](LIST ((PAGE NIL (PAPERSIZE LETTER FOLIOINFO (ARABIC "" "") STARTINGPAGE# 15) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (TEXT NIL NIL (54 54 504 702) NIL))) (PAGE NIL (PAPERSIZE LETTER FOLIOINFO (ARABIC "" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD LEFT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (54 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGV) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE VERSOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL))) (PAGE NIL (PAPERSIZE LETTER FOLIOINFO (ARABIC "" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE RECTOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL)))))3<01><01>T3HH<01>
<01>T-<01>T2ll<01><01>2HH<01>
<01>,HH<01>
,HH<01>,HH<01>-<01>T-<01><00><01>TF<01><01> PAGEHEADING VERSOHEADF<01><01> PAGEHEADING RECTOHEADE<01><01> PAGEHEADINGFOOTINGVE<01><01> PAGEHEADINGFOOTINGR TITAN
CLASSIC
TITAN
 HELVETICA HELVETICA
CLASSIC
 HELVETICAMODERNMODERNMODERN
MODERN
 HRULE.GETFNMODERN

4
 HRULE.GETFNMODERN


4
  HRULE.GETFNMODERN


  HRULE.GETFNMODERN


  HRULE.GETFNMODERN A $IM.INDEX.GETFNMODERN

I<00>
 HRULE.GETFNMODERN
 HRULE.GETFNMODERN<00>5IM.INDEX.GETFN
 )



 







<3IM.INDEX.GETFNMODERN


 



!




U
 





#







 


5




j

 
 


  

%


/




.

 HRULE.GETFNMODERN
  HRULE.GETFNMODERN<00>
$ <0B><00>z<EFBFBD>