1.10 <SoupCache>

Class: <SoupCache>

It derives from <GObject>.

File-based cache for HTTP resources.

Fields

parent-instance

Properties

Property: cache:cache-dir self

The directory to store the cache files.

Its value is a string, or #f.

It can only be set when the object is made, with #:cache-dir.

Property: cache:cache-type self

Whether the cache is private or shared.

Its value is a <SoupCacheType> (or, to set it, one of its symbols).

It can only be set when the object is made, with #:cache-type.

Procedures

Method: cache:clear self
Method: clear self

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 Cache

self

Passed: a <SoupCache>.

a <SoupCache>

Method: cache:dump self
Method: dump self

Synchronously writes the cache index out to disk.

Contrast with 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 Cache

self

Passed: a <SoupCache>.

a <SoupCache>

Method: cache:flush self
Method: flush self

Forces all pending writes in the self to be committed to disk.

For doing so it will iterate the <GMainContext> associated with self’s session as long as needed.

Contrast with Cache.dump, which writes out the cache index file.

self

Passed: a <SoupCache>.

a <SoupCache>

Method: cache:get-max-size self ⇒ %return
Method: get-max-size self ⇒ %return

Gets the maximum size of the cache.

self

Passed: a <SoupCache>.

a <SoupCache>

%return

Returned: an unsigned 32-bit integer.

the maximum size of the cache, in bytes.

Method: cache:load self

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 Cache

self

Passed: a <SoupCache>.

a <SoupCache>

Procedure: cache:new cache-dir cache-type ⇒ %return

Creates a new <SoupCache>.

cache-dir

Passed: a string, or #f.

the directory to store the cached data, or #f 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 passing #f.

cache-type

Passed: a <SoupCacheType>, or one of its symbols.

the <SoupCacheType> of the cache

%return

Returned: a <SoupCache>.

a new <SoupCache>

Method: cache:set-max-size self max-size
Method: set-max-size self max-size

Sets the maximum size of the cache.

self

Passed: a <SoupCache>.

a <SoupCache>

max-size

Passed: an unsigned 32-bit integer.

the maximum size of the cache, in bytes

Virtual methods

Virtual method: cache:do-get-cacheability implementor self msg ⇒ %return

To override it in a new class, give register-type #:vfuncs `((get-cacheability . ,procedure)). The procedure is called as (procedure self msg) ⇒ %return.

implementor

Passed: the class whose implementation to call: <SoupCache>, or a class that derives from it, or its GType number.

self

Passed: a <SoupCache>.

msg

Passed: a <SoupMessage>.

%return

Returned: a <SoupCacheability>.