Soup.Cache¶
| Subclasses: | None |
|---|
Methods¶
| Inherited: | GObject.Object (37), Soup.SessionFeature (5) |
|---|---|
| Structs: | GObject.ObjectClass (5) |
| class | new (cache_dir, cache_type) |
clear () |
|
dump () |
|
flush () |
|
get_max_size () |
|
load () |
|
set_max_size (max_size) |
Properties¶
| Name | Type | Flags | Short Description |
|---|---|---|---|
cache-dir |
str |
r/w/co | The directory to store the cache files |
cache-type |
Soup.CacheType |
r/w/co | Whether the cache is private or shared |
Signals¶
| Inherited: | GObject.Object (1) |
|---|
Class Details¶
-
class
Soup.Cache(**kwargs)¶ Bases: GObject.Object,Soup.SessionFeatureAbstract: No Structure: Soup.CacheClass-
classmethod
new(cache_dir, cache_type)¶ Parameters: - cache_dir (
strorNone) – the directory to store the cached data, orNoneto 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.CacheTypeof the cache
Returns: a new
Soup.CacheReturn type: Creates a new
Soup.Cache.New in version 2.34.
- cache_dir (
-
clear()¶ Will remove all entries in the self plus all the cache files.
New in version 2.34.
-
dump()¶ Synchronously writes the cache index out to disk. Contrast with
Soup.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.
New in version 2.34..
-
flush()¶ This function will force all pending writes in the self to be committed to disk. For doing so it will iterate the
GLib.MainContextassociated with self’s session as long as needed.Contrast with
Soup.Cache.dump(), which writes out the cache index file.New in version 2.34.
-
get_max_size()¶ Returns: the maximum size of the cache, in bytes. Return type: intGets the maximum size of the cache.
New in version 2.34.
-
load()¶ Loads the contents of self’s index into memory.
New in version 2.34.
-
set_max_size(max_size)¶ Parameters: max_size ( int) – the maximum size of the cache, in bytesSets the maximum size of the cache.
New in version 2.34.
-
do_get_cacheability(msg) virtual¶ Parameters: msg ( Soup.Message) –Return type: Soup.Cacheability
-
classmethod
Property Details¶
-
Soup.Cache.props.cache_dir¶ Name: cache-dirType: strDefault Value: NoneFlags: READABLE,WRITABLE,CONSTRUCT_ONLYThe directory to store the cache files
-
Soup.Cache.props.cache_type¶ Name: cache-typeType: Soup.CacheTypeDefault Value: Soup.CacheType.SINGLE_USERFlags: READABLE,WRITABLE,CONSTRUCT_ONLYWhether the cache is private or shared