EBackend.FileCache¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
The filename of the cache |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class EBackend.FileCache(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Contains only private data that should be read and manipulated using the functions below.
- classmethod new(filename)¶
- Parameters:
filename (
str
) – filename where the cache is kept- Returns:
a new
EBackend.FileCache
- Return type:
Creates a new
EBackend.FileCache
object, which implements a cache of objects. Useful for remote backends.
- add_object(key, value)¶
- Parameters:
- Returns:
- Return type:
Adds a new key / value entry to self. If an object corresponding to key already exists in self, the function returns
False
.
- freeze_changes()¶
Disables temporarily all writes to disk for self.
- get_filename()¶
- Returns:
The name of the cache.
- Return type:
Gets the name of the file where the cache is being stored.
- get_keys()¶
- Returns:
a list of keys
- Return type:
[
str
]
Returns a list of keys in self. The keys are owned by self and must not be modified or freed. Free the returned list with g_slist_free().
- get_object(key)¶
- Parameters:
key (
str
) – the hash key of the object to find- Returns:
the object corresponding to key
- Return type:
Returns the object corresponding to key. If no such object exists in self, the function returns
None
.
- get_objects()¶
- Returns:
a list of objects
- Return type:
[
str
]
Returns a list of objects in self. The objects are owned by self and must not be modified or freed. Free the returned list with g_slist_free().
- remove()¶
-
Remove the cache from disk.
- remove_object(key)¶
- Parameters:
key (
str
) – the hash key of the object to remove- Returns:
- Return type:
Removes the object corresponding to key from self. If no such object exists in self, the function returns
False
.
- replace_object(key, new_value)¶
- Parameters:
- Returns:
- Return type:
Replaces the object corresponding to key with new_value. If no such object exists in self, the function returns
False
.
- thaw_changes()¶
Reverts the affects of
EBackend.FileCache.freeze_changes
(). Each change to self is once again written to disk.
Property Details¶
- EBackend.FileCache.props.filename¶
- Name:
filename
- Type:
- Default Value:
''
- Flags:
The filename of the cache.