Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
File-based cache for HTTP resources.
Synopsis
- newtype Cache = Cache (ManagedPtr Cache)
- class (GObject o, IsDescendantOf Cache o) => IsCache o
- toCache :: (MonadIO m, IsCache o) => o -> m Cache
- cacheClear :: (HasCallStack, MonadIO m, IsCache a) => a -> m ()
- cacheDump :: (HasCallStack, MonadIO m, IsCache a) => a -> m ()
- cacheFlush :: (HasCallStack, MonadIO m, IsCache a) => a -> m ()
- cacheGetMaxSize :: (HasCallStack, MonadIO m, IsCache a) => a -> m Word32
- cacheLoad :: (HasCallStack, MonadIO m, IsCache a) => a -> m ()
- cacheNew :: (HasCallStack, MonadIO m) => Maybe Text -> CacheType -> m Cache
- cacheSetMaxSize :: (HasCallStack, MonadIO m, IsCache a) => a -> Word32 -> m ()
- constructCacheCacheDir :: (IsCache o, MonadIO m) => Text -> m (GValueConstruct o)
- getCacheCacheDir :: (MonadIO m, IsCache o) => o -> m (Maybe Text)
- constructCacheCacheType :: (IsCache o, MonadIO m) => CacheType -> m (GValueConstruct o)
- getCacheCacheType :: (MonadIO m, IsCache o) => o -> m CacheType
Exported types
Memory-managed wrapper type.
Instances
Eq Cache Source # | |
GObject Cache Source # | |
Defined in GI.Soup.Objects.Cache | |
ManagedPtrNewtype Cache Source # | |
Defined in GI.Soup.Objects.Cache toManagedPtr :: Cache -> ManagedPtr Cache | |
TypedObject Cache Source # | |
Defined in GI.Soup.Objects.Cache | |
HasParentTypes Cache Source # | |
Defined in GI.Soup.Objects.Cache | |
IsGValue (Maybe Cache) Source # | Convert |
Defined in GI.Soup.Objects.Cache gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Cache -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Cache) | |
type ParentTypes Cache Source # | |
Defined in GI.Soup.Objects.Cache |
class (GObject o, IsDescendantOf Cache o) => IsCache o Source #
Instances
(GObject o, IsDescendantOf Cache o) => IsCache o Source # | |
Defined in GI.Soup.Objects.Cache |
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, clear, dump, flush, forceFloating, freezeNotify, getv, isFloating, load, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getMaxSize, getProperty, getQdata.
Setters
clear
:: (HasCallStack, MonadIO m, IsCache a) | |
=> a |
|
-> m () |
Will remove all entries in the cache
plus all the cache files.
This is not thread safe and must be called only from the thread that created the Cache
dump
:: (HasCallStack, MonadIO m, IsCache a) | |
=> a |
|
-> m () |
Synchronously writes the cache index out to disk.
Contrast with [methodcache
.flush], which writes pending cache *entries* to
disk.
You must call this before exiting if you want your cache data to persist between sessions.
This is not thread safe and must be called only from the thread that created the Cache
flush
:: (HasCallStack, MonadIO m, IsCache a) | |
=> a |
|
-> m () |
Forces all pending writes in the cache
to be
committed to disk.
For doing so it will iterate the [structgLib
.MainContext] associated with
cache
's session as long as needed.
Contrast with [methodcache
.dump], which writes out the cache index file.
getMaxSize
:: (HasCallStack, MonadIO m, IsCache a) | |
=> a |
|
-> m Word32 | Returns: the maximum size of the cache, in bytes. |
Gets the maximum size of the cache.
load
:: (HasCallStack, MonadIO m, IsCache a) | |
=> a |
|
-> m () |
Loads the contents of cache
's index into memory.
This is not thread safe and must be called only from the thread that created the Cache
new
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> CacheType |
|
-> m Cache | Returns: a new |
Creates a new Cache
.
setMaxSize
:: (HasCallStack, MonadIO m, IsCache a) | |
=> a |
|
-> Word32 |
|
-> m () |
Sets the maximum size of the cache.
Properties
cacheDir
The directory to store the cache files.
constructCacheCacheDir :: (IsCache o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “cache-dir
” property. This is rarely needed directly, but it is used by new
.
getCacheCacheDir :: (MonadIO m, IsCache o) => o -> m (Maybe Text) Source #
Get the value of the “cache-dir
” property.
When overloading is enabled, this is equivalent to
get
cache #cacheDir
cacheType
Whether the cache is private or shared.
constructCacheCacheType :: (IsCache o, MonadIO m) => CacheType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “cache-type
” property. This is rarely needed directly, but it is used by new
.
getCacheCacheType :: (MonadIO m, IsCache o) => o -> m CacheType Source #
Get the value of the “cache-type
” property.
When overloading is enabled, this is equivalent to
get
cache #cacheType