Class Cache
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gobject.GObject
org.gnome.soup.Cache
- All Implemented Interfaces:
SessionFeature, Proxy
File-based cache for HTTP resources.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCache.Builder<B extends Cache.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface SessionFeature
SessionFeature.SessionFeature$Impl, SessionFeature.SessionFeatureInterface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CacheasParent()Return this instance as if it were its parent type.static Cache.Builder<? extends Cache.Builder> builder()ACache.Builderobject constructs aCachewith the specified properties.voidclear()Will remove all entries in the this Cache plus all the cache files.voiddump()Synchronously writes the cache index out to disk.voidflush()Forces all pending writes in the this Cache to be committed to disk.protected Set<Cacheability> getCacheability(Message msg) intGets the maximum size of the cache.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Cache class.voidload()Loads the contents ofcache'sindex into memory.voidsetMaxSize(int maxSize) Sets the maximum size of the cache.Methods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Cache
Create a Cache instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Cache
Creates a newSoupCache.- Parameters:
cacheDir- the directory to store the cached data, ornullto use the default one. Note that since the cache isn't safe to access for multiple processes at once, and the default directory isn't namespaced by process, clients are strongly discouraged from passingnull.cacheType- theSoupCacheTypeof the cache
-
Cache
public Cache()Create a new Cache.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
clear
public void clear()Will remove all entries in the this Cache plus all the cache files.
This is not thread safe and must be called only from the thread that created the
Cache -
dump
public void dump() -
flush
public void flush()Forces all pending writes in the this Cache to be committed to disk.
For doing so it will iterate the
GLib.MainContextassociated withcache'ssession as long as needed.Contrast with
dump(), which writes out the cache index file. -
getMaxSize
public int getMaxSize()Gets the maximum size of the cache.- Returns:
- the maximum size of the cache, in bytes.
-
load
public void load()Loads the contents of
cache'sindex into memory.This is not thread safe and must be called only from the thread that created the
Cache -
setMaxSize
public void setMaxSize(int maxSize) Sets the maximum size of the cache.- Parameters:
maxSize- the maximum size of the cache, in bytes
-
getCacheability
-
builder
ACache.Builderobject constructs aCachewith the specified properties. Use the variousset...()methods to set properties, and finish construction withCache.Builder.build().- Returns:
- the builder object
-