GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing docs.python.org — 6.5 statcache -- An optimization of os.stat()

Previous Page Up One Level Next Page Python Library Reference Contents Module Index Index
Previous: 6.4 stat Up: 6. Generic Operating System Next: 6.6 statvfs

6.5 statcache -- An optimization of os.stat()

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)


Previous Page Up One Level Next Page Python Library Reference Contents Module Index Index
Previous: 6.4 stat Up: 6. Generic Operating System Next: 6.6 statvfs

See About this document... for information on suggesting changes.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.