Package suds :: Module cache :: Class FileCache
[hide private]
[frames] | no frames]

Class FileCache

source code

Cache --+
        |
       FileCache
Known Subclasses:

A file-based URL cache.

Instance Methods [hide private]
 
__init__(self, location=None, **duration) source code
str
fnsuffix(self)
Get the file name suffix
source code
 
setduration(self, **duration)
Set the caching duration which defines how long the file will be cached.
source code
 
setlocation(self, location)
Set the location (directory) for the cached files.
source code
 
mktmp(self)
Make the location directory if it doesn't already exits.
source code
 
put(self, id, bfr)
Put a object into the cache.
source code
 
putf(self, id, fp)
Write a fp into the cache.
source code
any
get(self, id)
Get a object from the cache by ID.
source code
any
getf(self, id)
Get a object from the cache by ID.
source code
 
validate(self, fn)
Validate that the file has not expired based on the duration.
source code
 
clear(self)
Clear all objects from the cache.
source code
 
purge(self, id)
Purge a object from the cache by id.
source code
 
open(self, fn, *args)
Open the cache file making sure the directory is created.
source code
 
checkversion(self) source code
 
__fn(self, id) source code
Class Variables [hide private]
  fnprefix = 'suds'
The file name prefix.
  units = ('months', 'weeks', 'days', 'hours', 'minutes', 'secon...
Instance Variables [hide private]
(unit, value) duration
The cached file duration which defines how long the file will be cached.
str location
The directory for the cached files.
Method Details [hide private]

__init__(self, location=None, **duration)
(Constructor)

source code 
Parameters:
  • location (str) - The directory for the cached files.
  • duration ({unit:value}) - The cached file duration which defines how long the file will be cached. A duration=0 means forever. The duration may be: (months|weeks|days|hours|minutes|seconds).

fnsuffix(self)

source code 

Get the file name suffix

Returns: str
The suffix

setduration(self, **duration)

source code 

Set the caching duration which defines how long the file will be cached.

Parameters:
  • duration ({unit:value}) - The cached file duration which defines how long the file will be cached. A duration=0 means forever. The duration may be: (months|weeks|days|hours|minutes|seconds).

setlocation(self, location)

source code 

Set the location (directory) for the cached files.

Parameters:
  • location (str) - The directory for the cached files.

put(self, id, bfr)

source code 

Put a object into the cache.

Parameters:
  • id - The object ID.
  • object - The object to add.
Overrides: Cache.put
(inherited documentation)

putf(self, id, fp)

source code 

Write a fp into the cache.

Parameters:
  • id - The object ID.
  • fp - File pointer.
Overrides: Cache.putf
(inherited documentation)

get(self, id)

source code 

Get a object from the cache by ID.

Parameters:
  • id - The object ID.
Returns: any
The object, else None
Overrides: Cache.get
(inherited documentation)

getf(self, id)

source code 

Get a object from the cache by ID.

Parameters:
  • id - The object ID.
Returns: any
The object, else None
Overrides: Cache.getf
(inherited documentation)

validate(self, fn)

source code 

Validate that the file has not expired based on the duration.

Parameters:
  • fn (str) - The file name.

clear(self)

source code 

Clear all objects from the cache.

Overrides: Cache.clear
(inherited documentation)

purge(self, id)

source code 

Purge a object from the cache by id.

Parameters:
  • id - A object ID.
Overrides: Cache.purge
(inherited documentation)

Class Variable Details [hide private]

units

Value:
('months', 'weeks', 'days', 'hours', 'minutes', 'seconds')