Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
pip._internal.network.cache.SafeFileCache Class Reference
Inheritance diagram for pip._internal.network.cache.SafeFileCache:
Inheritance graph
[legend]
Collaboration diagram for pip._internal.network.cache.SafeFileCache:
Collaboration graph
[legend]

Public Member Functions

None __init__ (self, str directory)
 
Optional[bytes] get (self, str key)
 
None set (self, str key, bytes value, Union[int, datetime, None] expires=None)
 
None delete (self, str key)
 
Optional[BinaryIO] get_body (self, str key)
 
None set_body (self, str key, bytes body)
 
- Public Member Functions inherited from pip._vendor.cachecontrol.cache.BaseCache
None close (self)
 

Public Attributes

 directory
 

Protected Member Functions

str _get_cache_path (self, str name)
 
None _write (self, str path, bytes data)
 

Detailed Description

A file based cache which is safe to use even when the target directory may
not be accessible or writable.

There is a race condition when two processes try to write and/or read the
same entry at the same time, since each entry consists of two separate
files (https://github.com/psf/cachecontrol/issues/324).  We therefore have
additional logic that makes sure that both files to be present before
returning an entry; this fixes the read side of the race condition.

For the write side, we assume that the server will only ever return the
same data for the same URL, which ought to be the case for files pip is
downloading.  PyPI does not have a mechanism to swap out a wheel for
another wheel, for example.  If this assumption is not true, the
CacheControl issue will need to be fixed.

Member Function Documentation

◆ delete()

None pip._internal.network.cache.SafeFileCache.delete (   self,
str  key 
)

◆ get()

Optional[bytes] pip._internal.network.cache.SafeFileCache.get (   self,
str  key 
)

◆ get_body()

Optional[BinaryIO] pip._internal.network.cache.SafeFileCache.get_body (   self,
str  key 
)
Return the body as file-like object.

Reimplemented from pip._vendor.cachecontrol.cache.SeparateBodyBaseCache.

◆ set()

None pip._internal.network.cache.SafeFileCache.set (   self,
str  key,
bytes  value,
Union[int, datetime, None]   expires = None 
)

◆ set_body()

None pip._internal.network.cache.SafeFileCache.set_body (   self,
str  key,
bytes  body 
)

The documentation for this class was generated from the following file: