Website hosting service by Active-Venture.com
  

 Back to Index

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

 

Deprecated since release 2.2. Use os.stat() directly instead of using the cache; the cache introduces a very high level of fragility in applications using it and complicates application code with the addition of cache management support.

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)

  

 

2002-2004 Active-Venture.com Webhosting Service

 

Disclaimer: This documentation is provided only for the benefits of our hosting customers.
For authoritative source of the documentation, please refer to http://python.org/doc/

 

Domain registration : Buy domain name or register domain name from $5.95/year only

 
Active-Domain.com offers cheap domain registration, domain name transfer and domain search services