Remoto - VFS: VFS_datastore_cache Class Reference
Remoto - VFS

A subclass of QCache and QObject. More...

#include <VFS_datastore.h>

Inheritance diagram for VFS_datastore_cache:

Public Member Functions

 VFS_datastore_cache (quint64 size)
 
virtual ~VFS_datastore_cache ()
 
bool insert (const QString &key, VFS_datastore_cache_entry *object)
 Insert a new entry. More...
 

Static Public Attributes

static const quint64 DEFAULT_DATACACHE_SIZE = 104857600
 The default size to create a cache. Defaults to 100mb. More...
 

Private Slots

void expired (VFS_datastore_cache_entry *)
 A cache entry has exipred. More...
 
void touched ()
 A cache entry has been touched. More...
 

Detailed Description

A subclass of QCache and QObject.

The QCache uses QString as a key, and will track VFS_datastore_cache_entry objects.

If the contents of the cache exceed the allowed size, oldest entries will be flushed and removed. Entries will have an expiration and if unmodified, will be flushed and removed from the cache.

Note
Because this is a class with double inheritance, it may be revisited and changed in the future.
See also
VFS_datastore_cache_entry

Definition at line 60 of file VFS_datastore.h.

Constructor & Destructor Documentation

◆ VFS_datastore_cache()

VFS_datastore_cache::VFS_datastore_cache ( quint64  size)
explicit
Parameters
sizeThe initial size of the cache, in bytes.

Definition at line 241 of file VFS_datastore.cpp.

◆ ~VFS_datastore_cache()

VFS_datastore_cache::~VFS_datastore_cache ( )
virtual

Definition at line 246 of file VFS_datastore.cpp.

Member Function Documentation

◆ expired

void VFS_datastore_cache::expired ( VFS_datastore_cache_entry e)
privateslot

A cache entry has exipred.

Remove it.

Parameters
eThe cache entry

If the entry was not found, write a warning to the log.

Definition at line 317 of file VFS_datastore.cpp.

◆ insert()

bool VFS_datastore_cache::insert ( const QString &  key,
VFS_datastore_cache_entry object 
)

Insert a new entry.

Parameters
keyEntry key
objectEntry object
Returns
Success or failure of insertion

This will also connect the expired() signal, allowing the cache to maintain expiration features.

If the insertion is unsuccessful, the result is undefined. The object is not deleted, but the owning VFS_node will need to decide what to do.

Definition at line 289 of file VFS_datastore.cpp.

◆ touched

void VFS_datastore_cache::touched ( )
privateslot

A cache entry has been touched.

Make sure the cache knows.

This will use the object() method to refresh the entry's access time.

Definition at line 334 of file VFS_datastore.cpp.

Member Data Documentation

◆ DEFAULT_DATACACHE_SIZE

const quint64 VFS_datastore_cache::DEFAULT_DATACACHE_SIZE = 104857600
static

The default size to create a cache. Defaults to 100mb.

Definition at line 74 of file VFS_datastore.h.


The documentation for this class was generated from the following files: