annotate Doc/lib/libstatcache.tex @ 17581:c1937faabb23 2.1

Added support for optional explanation parameter to the \versionadded macro. Refactored do_cmd_versionadded() and do_cmd_versionchanged() to do most of the work in a helper function, with the do_cmd_*() wrappers just supplying a portion of the replacement text.
author Fred Drake <fdrake@acm.org>
date Wed, 18 Apr 2001 17:29:14 +0000
parents d7864345b1c8
children 3803af9d8796
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10996
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
1 \section{\module{statcache} ---
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
2 An optimization of \function{os.stat()}}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
3
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
4 \declaremodule{standard}{statcache}
15467
d7864345b1c8 Update Moshe Zadka's email address to one works and might last a while.
Fred Drake <fdrake@acm.org>
parents: 11004
diff changeset
5 \sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il}
10996
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
6 \modulesynopsis{Stat files, and remember results.}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
7
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
8 The \module{statcache} module provides a simple optimization to
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
9 \function{os.stat()}: remembering the values of previous invocations.
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
10
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
11 The \module{statcache} module defines the following functions:
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
12
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
13 \begin{funcdesc}{stat}{path}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
14 This is the main module entry-point.
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
15 Identical for \function{os.stat()}, except for remembering the result
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
16 for future invocations of the function.
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
17 \end{funcdesc}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
18
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
19 The rest of the functions are used to clear the cache, or parts of
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
20 it.
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
21
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
22 \begin{funcdesc}{reset}{}
11004
8c114ede0568 Minor markup nits.
Fred Drake <fdrake@acm.org>
parents: 10996
diff changeset
23 Clear the cache: forget all results of previous \function{stat()}
8c114ede0568 Minor markup nits.
Fred Drake <fdrake@acm.org>
parents: 10996
diff changeset
24 calls.
10996
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
25 \end{funcdesc}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
26
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
27 \begin{funcdesc}{forget}{path}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
28 Forget the result of \code{stat(\var{path})}, if any.
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
29 \end{funcdesc}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
30
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
31 \begin{funcdesc}{forget_prefix}{prefix}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
32 Forget all results of \code{stat(\var{path})} for \var{path} starting
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
33 with \var{prefix}.
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
34 \end{funcdesc}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
35
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
36 \begin{funcdesc}{forget_dir}{prefix}
11004
8c114ede0568 Minor markup nits.
Fred Drake <fdrake@acm.org>
parents: 10996
diff changeset
37 Forget all results of \code{stat(\var{path})} for \var{path} a file in
10996
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
38 the directory \var{prefix}, including \code{stat(\var{prefix})}.
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
39 \end{funcdesc}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
40
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
41 \begin{funcdesc}{forget_except_prefix}{prefix}
11004
8c114ede0568 Minor markup nits.
Fred Drake <fdrake@acm.org>
parents: 10996
diff changeset
42 Similar to \function{forget_prefix()}, but for all \var{path} values
10996
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
43 \emph{not} starting with \var{prefix}.
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
44 \end{funcdesc}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
45
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
46 Example:
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
47
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
48 \begin{verbatim}
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
49 >>> import os, statcache
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
50 >>> statcache.stat('.')
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
51 (16893, 2049, 772, 18, 1000, 1000, 2048, 929609777, 929609777, 929609777)
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
52 >>> os.stat('.')
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
53 (16893, 2049, 772, 18, 1000, 1000, 2048, 929609777, 929609777, 929609777)
84ab14d85763 New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff changeset
54 \end{verbatim}