Movatterモバイル変換


[0]ホーム

URL:


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:6.4 statUp:6. Generic Operating SystemNext:6.6 statvfs

6.5statcache -- An optimization ofos.stat()

Deprecated since release 2.2.Useos.stat() directly insteadof using the cache; the cache introduces a very high level offragility in applications using it and complicates application codewith the addition of cache management support.

Thestatcache module provides a simple optimization toos.stat(): remembering the values of previous invocations.

Thestatcache module defines the following functions:

stat(path)
This is the main module entry-point.Identical foros.stat(), except for remembering the resultfor future invocations of the function.

The rest of the functions are used to clear the cache, or parts ofit.

reset()
Clear the cache: forget all results of previousstat()calls.

forget(path)
Forget the result ofstat(path), if any.

forget_prefix(prefix)
Forget all results ofstat(path) forpath startingwithprefix.

forget_dir(prefix)
Forget all results ofstat(path) forpath a file in the directoryprefix, includingstat(prefix).

forget_except_prefix(prefix)
Similar toforget_prefix(), but for allpath valuesnot starting withprefix.

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 PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:6.4 statUp:6. Generic Operating SystemNext:6.6 statvfs
Release 2.2.3, documentation updated on 30 May 2003.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2026 Movatter.jp