Cache Park - Accessing G-Golf caches.
G-Golf has and uses a cache ‘mechanism’ - actually several, but
only one is (partially) exposed to users (and with reserves, see
below), also referred to as G-Golf main cache
- not only for
internal needs, but also to avoid reconstructing things
‘on-the-fly’ unnecessarily, such as already imported
<gi-enum>, <gi-flags> and <gi-struct> instances.
G-Golf main cache
exposed functionality is ‘access only’ -
users should not (never) attempt to change its content - and its design
is not (yet) ‘set in stone’, so interfaces here exposed, may (have
to be) change(d).
So, keeping the above reserves in mind, G-Golf main cache
current
data structure is composed of two nested association lists, to which we
refer using m-key (main key) and s-key (secondary key).
Returns nothing.
Displays the content of G-Golf main cache. If m-key (main key) is
#f
(the default), it displays the list of the main keys present
in the cache. Otherwise, it retrieves the content of the main cache for
m-key and displays its content if any, or -- is empty --
if
none.
Returns a %gi-cache entry or #f
.
Obtains and returns the %gi-cache entry for m-key and
s-key, or #f
if none is found.
Remember that you may (always) view the list of main and secondary key
names (which is ‘dynamic’, depending on what you have imported) by
calling gi-cache-show (without or with an m-key arg
appropriately), but as a user, the two most important m-key are
'enum
and 'flags
, so you may check their member names, or
bind their instance locally.
Main key names are given by G-Golf. Secondary key names are always the result of calling g-name->name upon the ‘object’ original name.
For example, let’s import, then retreive and visualize the content of
the GtkPositionType
(enum) type:
,use (g-golf) (gi-import-by-name "Gtk" "PositionType") ⇒ $2 = #<<gi-enum> 7ff938938b40> (gi-cache-ref 'enum 'gtk-position-type) ⇒ $3 = #<<gi-enum> 7ff938938b40> (describe $3) -| #<<gi-enum> 7ff938938b40> is an instance of class <gi-enum> -| Slots are: -| enum-set = ((left . 0) (right . 1) (top . 2) (bottom . 3)) -| g-type = 94673466933568 -| g-name = "GtkPositionType" -| name = gtk-position-type
Holds a reference the the G-Golf main cache
, which as said
earlier, currently is composed of two nested association lists.