Soup.Cache¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
The directory to store the cache files |
||
r/w/co |
Whether the cache is private or shared |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Soup.Cache(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
File-based cache for HTTP resources.
- classmethod new(cache_dir, cache_type)¶
- Parameters:
cache_dir (
str
orNone
) – the directory to store the cached data, orNone
to use the default one. Note that since the cache isn’t safe to access for multiple processes at once, and the default directory isn’t namespaced by process, clients are strongly discouraged from passingNone
.cache_type (
Soup.CacheType
) – theSoup.CacheType
of the cache
- Returns:
a new
Soup.Cache
- Return type:
Creates a new
Soup.Cache
.
- clear()¶
Will remove all entries in the self plus all the cache files.
This is not thread safe and must be called only from the thread that created the
Soup.Cache
- dump()¶
Synchronously writes the cache index out to disk.
Contrast with [method`Cache`.flush], which writes pending cache *entries* to disk.
You must call this before exiting if you want your cache data to persist between sessions.
This is not thread safe and must be called only from the thread that created the
Soup.Cache
- flush()¶
Forces all pending writes in the self to be committed to disk.
For doing so it will iterate the [struct`GLib`.MainContext] associated with self's session as long as needed.
Contrast with [method`Cache`.dump], which writes out the cache index file.
- get_max_size()¶
- Returns:
the maximum size of the cache, in bytes.
- Return type:
Gets the maximum size of the cache.
- load()¶
Loads the contents of self's index into memory.
This is not thread safe and must be called only from the thread that created the
Soup.Cache
- set_max_size(max_size)¶
- Parameters:
max_size (
int
) – the maximum size of the cache, in bytes
Sets the maximum size of the cache.
- do_get_cacheability(msg) virtual¶
- Parameters:
msg (
Soup.Message
) –- Return type:
Property Details¶
- Soup.Cache.props.cache_dir¶
- Name:
cache-dir
- Type:
- Default Value:
- Flags:
The directory to store the cache files.
- Soup.Cache.props.cache_type¶
- Name:
cache-type
- Type:
- Default Value:
- Flags:
Whether the cache is private or shared.