KDAV 5.109.0
Public Member Functions | Protected Member Functions | List of all members
KDAV::EtagCache

A helper class to cache ETags. More...

#include <KDAV/EtagCache>

Public Member Functions

 EtagCache (QObject *parent=nullptr)
 Creates a new ETag cache and populates it with the ETags of items found in collection.
 
QStringList changedRemoteIds () const
 Returns the list of remote ids of items that have been changed in the backend.
 
bool contains (const QString &remoteId) const
 Checks if the given item is in the cache.
 
bool etagChanged (const QString &remoteId, const QString &refEtag) const
 Check if the known ETag for the remote ID is equal to refEtag.
 
bool isOutOfDate (const QString &remoteId) const
 Returns true if the remote ID is marked as changed (is contained in the return of changedRemoteIds)
 
void markAsChanged (const QString &remoteId)
 Mark an item as changed in the backend.
 
void removeEtag (const QString &remoteId)
 Removes the entry for item with remote ID remoteId.
 
void setEtag (const QString &remoteId, const QString &etag)
 Sets the ETag for the remote ID.
 
QStringList urls () const
 Returns the list of all items URLs.
 

Protected Member Functions

void setEtagInternal (const QString &remoteId, const QString &etag)
 Sets the ETag for the remote ID.
 

Detailed Description

A helper class to cache ETags.

The EtagCache caches the remote ids and ETags of all items in a given collection. This cache is needed to find out which items have been changed in the backend and have to be refetched on the next call of Akonadi::ResourceBase::retrieveItems()

Constructor & Destructor Documentation

◆ EtagCache()

KDAV::EtagCache::EtagCache ( QObject *  parent = nullptr)
explicit

Creates a new ETag cache and populates it with the ETags of items found in collection.

Member Function Documentation

◆ changedRemoteIds()

QStringList KDAV::EtagCache::changedRemoteIds ( ) const

Returns the list of remote ids of items that have been changed in the backend.

◆ contains()

bool KDAV::EtagCache::contains ( const QString &  remoteId) const

Checks if the given item is in the cache.

◆ etagChanged()

bool KDAV::EtagCache::etagChanged ( const QString &  remoteId,
const QString &  refEtag 
) const

Check if the known ETag for the remote ID is equal to refEtag.

◆ isOutOfDate()

bool KDAV::EtagCache::isOutOfDate ( const QString &  remoteId) const

Returns true if the remote ID is marked as changed (is contained in the return of changedRemoteIds)

◆ markAsChanged()

void KDAV::EtagCache::markAsChanged ( const QString &  remoteId)

Mark an item as changed in the backend.

◆ removeEtag()

void KDAV::EtagCache::removeEtag ( const QString &  remoteId)

Removes the entry for item with remote ID remoteId.

◆ setEtag()

void KDAV::EtagCache::setEtag ( const QString &  remoteId,
const QString &  etag 
)

Sets the ETag for the remote ID.

If the remote ID is marked as changed (is contained in the return of changedRemoteIds), remove it from the changed list.

◆ setEtagInternal()

void KDAV::EtagCache::setEtagInternal ( const QString &  remoteId,
const QString &  etag 
)
protected

Sets the ETag for the remote ID.

◆ urls()

QStringList KDAV::EtagCache::urls ( ) const

Returns the list of all items URLs.