Top |
Functions
EFileCache * | e_file_cache_new () |
gboolean | e_file_cache_remove () |
gboolean | e_file_cache_clean () |
const gchar * | e_file_cache_get_object () |
GSList * | e_file_cache_get_objects () |
GSList * | e_file_cache_get_keys () |
gboolean | e_file_cache_add_object () |
gboolean | e_file_cache_replace_object () |
gboolean | e_file_cache_remove_object () |
void | e_file_cache_freeze_changes () |
void | e_file_cache_thaw_changes () |
const gchar * | e_file_cache_get_filename () |
Description
An EFileCache is a simple hash table of strings backed by an XML file
for permanent storage. The XML file is written to disk with every unless
the cache is temporarily frozen with e_file_cache_freeze_changes()
.
Functions
e_file_cache_new ()
EFileCache *
e_file_cache_new (const gchar *filename
);
Creates a new EFileCache object, which implements a cache of objects. Useful for remote backends.
e_file_cache_remove ()
gboolean
e_file_cache_remove (EFileCache *cache
);
Remove the cache from disk.
e_file_cache_clean ()
gboolean
e_file_cache_clean (EFileCache *cache
);
Clean up the cache's contents.
e_file_cache_get_object ()
const gchar * e_file_cache_get_object (EFileCache *cache
,const gchar *key
);
Returns the object corresponding to key
. If no such object exists
in cache
, the function returns NULL
.
e_file_cache_get_objects ()
GSList *
e_file_cache_get_objects (EFileCache *cache
);
Returns a list of objects in cache
. The objects are owned by cache
and
must not be modified or freed. Free the returned list with g_slist_free()
.
e_file_cache_get_keys ()
GSList *
e_file_cache_get_keys (EFileCache *cache
);
Returns a list of keys in cache
. The keys are owned by cache
and must
not be modified or freed. Free the returned list with g_slist_free()
.
e_file_cache_add_object ()
gboolean e_file_cache_add_object (EFileCache *cache
,const gchar *key
,const gchar *value
);
Adds a new key
/ value
entry to cache
. If an object corresponding
to key
already exists in cache
, the function returns FALSE
.
e_file_cache_replace_object ()
gboolean e_file_cache_replace_object (EFileCache *cache
,const gchar *key
,const gchar *new_value
);
Replaces the object corresponding to key
with new_value
.
If no such object exists in cache
, the function returns FALSE
.
Parameters
cache |
an EFileCache |
|
key |
the hash key of the object to replace |
|
new_value |
the new object for |
e_file_cache_remove_object ()
gboolean e_file_cache_remove_object (EFileCache *cache
,const gchar *key
);
Removes the object corresponding to key
from cache
.
If no such object exists in cache
, the function returns FALSE
.
e_file_cache_freeze_changes ()
void
e_file_cache_freeze_changes (EFileCache *cache
);
Disables temporarily all writes to disk for cache
.
e_file_cache_thaw_changes ()
void
e_file_cache_thaw_changes (EFileCache *cache
);
Reverts the affects of e_file_cache_freeze_changes()
.
Each change to cache
is once again written to disk.
e_file_cache_get_filename ()
const gchar *
e_file_cache_get_filename (EFileCache *cache
);
Gets the name of the file where the cache is being stored.