Camel.DataCache¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | new(path) | 
| add(path, key) | |
| clear(path) | |
| foreach_remove(path, func, *user_data) | |
| get(path, key) | |
| get_expire_enabled() | |
| get_filename(path, key) | |
| get_path() | |
| remove(path, key) | |
| set_expire_access(when) | |
| set_expire_age(when) | |
| set_expire_enabled(expire_enabled) | |
| set_path(path) | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
Properties¶
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| expire-enabled | bool | r/w/c/en | |
| path | str | r/w/c/en | 
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Camel.DataCache(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - Camel.DataCacheClass- 
classmethod new(path)¶
- Parameters: - path ( - str) – Base path of cache, subdirectories will be created here.- Raises: - GLib.Error- Returns: - A new cache object, or - Noneif the base path cannot be written to.- Return type: - Camel.DataCache- Create a new data cache. 
 - 
add(path, key)¶
- Parameters: - Raises: - Returns: - a - Gio.IOStreamfor the new cache item, or- None- Return type: - Add a new item to the cache, returning a - Gio.IOStreamto the new item.- The key and the path combine to form a unique key used to store the item. - Potentially, expiry processing will be performed while this call is executing. - The returned - Gio.IOStreamis referenced for thread-safety and must be unreferenced with- GObject.Object.unref() when finished with it.
 - 
clear(path)¶
- Parameters: - path ( - str) – Path to the (sub) cache the item exists in.- Clear cache’s content in path. - New in version 3.2. 
 - 
foreach_remove(path, func, *user_data)¶
- Parameters: - path (str) – Path to the (sub) cache the items exist in
- func (Camel.DataCacheRemoveFunc) – a callback to call for each found file in the cache
- user_data (objectorNone) – user data passed to func
 - Traverses the self sub-cache identified by path and calls func for each found file. If the func returns - True, then the file is removed, if- False, it’s kept in the cache.- New in version 3.26. 
- path (
 - 
get(path, key)¶
- Parameters: - Raises: - Returns: - a - Gio.IOStreamfor the requested cache item, or- None- Return type: - Lookup an item in the cache. If the item exists, a - Gio.IOStreamis returned for the item. The stream may be shared by multiple callers, so ensure the stream is in a valid state through external locking.- The returned - Gio.IOStreamis referenced for thread-safety and must be unreferenced with- GObject.Object.unref() when finished with it.
 - 
get_expire_enabled()¶
- Returns: - Whether expire is enabled. - Return type: - bool- Gets whether expire of cache data is enabled. - This is a complementary property for - Camel.DataCache.set_expire_age() and- Camel.DataCache.set_expire_access(), which allows to disable expiry without touching the two values. Having expire enabled, but not have set any of the two times, still behaves like not having expiry enabled.- New in version 3.24. 
 - 
get_filename(path, key)¶
- Parameters: - Returns: - The filename for a cache item - Return type: - Lookup the filename for an item in the cache - New in version 2.26. 
 - 
get_path()¶
- Returns: - the path to the data cache - Return type: - str- Returns the path to the data cache. - New in version 2.32. 
 - 
remove(path, key)¶
- Parameters: - Raises: - Returns: - 0 on success, -1 on error - Return type: - Remove/expire a cache item. 
 - 
set_expire_access(when)¶
- Parameters: - when ( - int) – Timeout for access, or -1 to disable access expiry.- Set the cache expiration policy for access times. - Items in the cache which haven’t been accessed for when seconds may be expired at any time. Items are expired in a lazy manner, so it is indeterminate when the items will physically be removed. - Note you can set both an age and an access limit. The age acts as a hard limit on cache entries. 
 - 
set_expire_age(when)¶
- Parameters: - when ( - int) – Timeout for age expiry, or -1 to disable.- Set the cache expiration policy for aged entries. - Items in the cache older than when seconds may be flushed at any time. Items are expired in a lazy manner, so it is indeterminate when the items will physically be removed. - Note you can set both an age and an access limit. The age acts as a hard limit on cache entries. 
 - 
set_expire_enabled(expire_enabled)¶
- Parameters: - expire_enabled ( - bool) – a value to set- Sets whether expire of cache data is enabled. - This is a complementary property for - Camel.DataCache.set_expire_age() and- Camel.DataCache.set_expire_access(), which allows to disable expiry without touching the two values. Having expire enabled, but not have set any of the two times, still behaves like not having expiry enabled.- New in version 3.24. 
 
- 
classmethod