Package org.gnome.glib
Class Cache
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.glib.Cache
- All Implemented Interfaces:
Proxy
Deprecated.
A
GCache
allows sharing of complex data structures, in order to
save system resources.
GCache
uses keys and values. A GCache
key describes the properties
of a particular resource. A GCache
value is the actual resource.
GCache
has been marked as deprecated, since this API is rarely
used and not very actively maintained.
-
Constructor Summary
ConstructorDescriptionCache
(MemorySegment address) Deprecated.Create a Cache proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Deprecated.insert
(@Nullable MemorySegment key) Deprecated.Use aGHashTable
insteadvoid
keyForeach
(HFunc func) Deprecated.Use aGHashTable
insteadstatic Cache
new_
(CacheNewFunc valueNewFunc, CacheDestroyFunc valueDestroyFunc, CacheDupFunc keyDupFunc, CacheDestroyFunc keyDestroyFunc, HashFunc hashKeyFunc, HashFunc hashValueFunc, EqualFunc keyEqualFunc) Deprecated.Use aGHashTable
insteadvoid
remove
(@Nullable MemorySegment value) Deprecated.Use aGHashTable
insteadvoid
valueForeach
(HFunc func) Deprecated.The reason is that it passes pointers to internal data structures tofunc
; use g_cache_key_foreach() insteadMethods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Cache
Deprecated.Create a Cache proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
new_
@Deprecated public static Cache new_(CacheNewFunc valueNewFunc, CacheDestroyFunc valueDestroyFunc, CacheDupFunc keyDupFunc, CacheDestroyFunc keyDestroyFunc, HashFunc hashKeyFunc, HashFunc hashValueFunc, EqualFunc keyEqualFunc) Deprecated.Use aGHashTable
insteadCreates a newGCache
.- Parameters:
valueNewFunc
- a function to create a new object given a key. This is called by g_cache_insert() if an object with the given key does not already existvalueDestroyFunc
- a function to destroy an object. It is called by g_cache_remove() when the object is no longer needed (i.e. its reference count drops to 0)keyDupFunc
- a function to copy a key. It is called by g_cache_insert() if the key does not already exist in theGCache
keyDestroyFunc
- a function to destroy a key. It is called by g_cache_remove() when the object is no longer needed (i.e. its reference count drops to 0)hashKeyFunc
- a function to create a hash value from a keyhashValueFunc
- a function to create a hash value from a valuekeyEqualFunc
- a function to compare two keys. It should returntrue
if the two keys are equivalent- Returns:
- a new
GCache
-
destroy
Deprecated.Use aGHashTable
insteadFrees the memory allocated for theGCache
.Note that it does not destroy the keys and values which were contained in the
GCache
. -
insert
Deprecated.Use aGHashTable
insteadGets the value corresponding to the given key, creating it if necessary. It first checks if the value already exists in theGCache
, by using thekeyEqualFunc
function passed to g_cache_new(). If it does already exist it is returned, and its reference count is increased by one. If the value does not currently exist, if is created by calling thevalueNewFunc
. The key is duplicated by callingkeyDupFunc
and the duplicated key and value are inserted into theGCache
.- Parameters:
key
- a key describing aGCache
object- Returns:
- a pointer to a
GCache
value
-
keyForeach
Deprecated.Use aGHashTable
insteadCalls the given function for each of the keys in theGCache
.NOTE
func
is passed three parameters, the value and key of a cache entry and theuserData
. The order of value and key is different from the order in which g_hash_table_foreach() passes key-value pairs to its callback function !- Parameters:
func
- the function to call with eachGCache
key
-
remove
Deprecated.Use aGHashTable
insteadDecreases the reference count of the given value. If it drops to 0 then the value and its corresponding key are destroyed, using thevalueDestroyFunc
andkeyDestroyFunc
passed to g_cache_new().- Parameters:
value
- the value to remove
-
valueForeach
Deprecated.The reason is that it passes pointers to internal data structures tofunc
; use g_cache_key_foreach() insteadCalls the given function for each of the values in theGCache
.- Parameters:
func
- the function to call with eachGCache
value
-
GHashTable
instead