An optimization of `os.stat()'
==============================
This manual section was written by Moshe Zadka
<moshez@zadka.site.co.il>.
Stat files, and remember results.
The `statcache' module provides a simple optimization to `os.stat()':
remembering the values of previous invocations.
The `statcache' module defines the following functions:
`stat(path)'
This is the main module entry-point. Identical for `os.stat()',
except for remembering the result for future invocations of the
function.
The rest of the functions are used to clear the cache, or parts of it.
`reset()'
Clear the cache: forget all results of previous `stat()' calls.
`forget(path)'
Forget the result of `stat(PATH)', if any.
`forget_prefix(prefix)'
Forget all results of `stat(PATH)' for PATH starting with PREFIX.
`forget_dir(prefix)'
Forget all results of `stat(PATH)' for PATH a file in the
directory PREFIX, including `stat(PREFIX)'.
`forget_except_prefix(prefix)'
Similar to `forget_prefix()', but for all PATH values _not_
starting with PREFIX.
Example:
>>> import os, statcache
>>> statcache.stat('.')
(16893, 2049, 772, 18, 1000, 1000, 2048, 929609777, 929609777, 929609777)
>>> os.stat('.')
(16893, 2049, 772, 18, 1000, 1000, 2048, 929609777, 929609777, 929609777)