KDAV::EtagCache Class

class KDAV::EtagCache

A helper class to cache ETags. More...

Header: #include <KDAV/EtagCache>
CMake: find_package(KF6 REQUIRED COMPONENTS DAV)
target_link_libraries(mytarget PRIVATE KF6::DAV)
Inherits: QObject

Public Functions

EtagCache(QObject *parent = nullptr)
QStringList changedRemoteIds() const
bool contains(const QString &remoteId) const
bool etagChanged(const QString &remoteId, const QString &refEtag) const
bool isOutOfDate(const QString &remoteId) const
void markAsChanged(const QString &remoteId)
void removeEtag(const QString &remoteId)
void setEtag(const QString &remoteId, const QString &etag)
QStringList urls() const

Protected Functions

void setEtagInternal(const QString &remoteId, const QString &etag)

Detailed Description

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()

Member Function Documentation

[explicit] EtagCache::EtagCache(QObject *parent = nullptr)

Creates a new ETag cache.

QStringList EtagCache::changedRemoteIds() const

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

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

Checks if the given item is in the cache

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

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

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

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

void EtagCache::markAsChanged(const QString &remoteId)

Mark an item as changed in the backend.

void EtagCache::removeEtag(const QString &remoteId)

Removes the entry for item with remote ID remoteId.

void 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.

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

Sets the ETag for the remote ID.

QStringList EtagCache::urls() const

Returns the list of all items URLs.