Akonadi::CachePolicy

Search for usage in LXR

Akonadi::CachePolicy Class Reference

#include <cachepolicy.h>

Public Member Functions

 CachePolicy ()
 
 CachePolicy (const CachePolicy &other)
 
 ~CachePolicy ()
 
int cacheTimeout () const
 
bool inheritFromParent () const
 
int intervalCheckTime () const
 
QStringList localParts () const
 
CachePolicyoperator= (const CachePolicy &other)
 
bool operator== (const CachePolicy &other) const
 
void setCacheTimeout (int timeout)
 
void setInheritFromParent (bool inherit)
 
void setIntervalCheckTime (int time)
 
void setLocalParts (const QStringList &parts)
 
void setSyncOnDemand (bool enable)
 
bool syncOnDemand () const
 

Detailed Description

Represents the caching policy for a collection.

There is one cache policy per collection. It can either specify that all properties of the policy of the parent collection will be inherited (the default) or specify the following values:

  • The item parts that should be permanently kept locally and are downloaded during a collection sync (e.g. full mail vs. just the headers).
  • A minimum time for which non-permanently cached item parts have to be kept (0 - infinity).
  • Whether or not a collection sync is triggered on demand, i.e. as soon as it is accessed by a client.
  • An optional time interval for regular collection sync (aka interval mail check).

Syncing means fetching updates from the Akonadi database. The cache policy does not affect updates of the Akonadi database from the backend, since backend updates will normally immediately trigger the resource to update the Akonadi database.

The cache policy applies only to reading from the collection. Writing to the collection is independent of cache policy - all updates are written to the backend as soon as the resource can schedule this.

policy.setCacheTimeout( 30 );
policy.setIntervalCheckTime( 20 );
Akonadi::Collection collection = ...
collection.setCachePolicy( policy );
Represents the caching policy for a collection.
Definition cachepolicy.h:60
void setIntervalCheckTime(int time)
Sets interval check time.
void setCacheTimeout(int timeout)
Sets cache timeout for non-permanently cached parts.
Represents a collection of PIM items.
Definition collection.h:62
void setCachePolicy(const CachePolicy &policy)
Sets the cache policy of the collection.
Todo

Do we also need a size limit for the cache as well?

on a POP3 account, is should not be possible to change locally cached parts, find a solution for that

Author
Volker Krause vkrau.nosp@m.se@k.nosp@m.de.or.nosp@m.g

Definition at line 59 of file cachepolicy.h.

Constructor & Destructor Documentation

◆ CachePolicy() [1/2]

CachePolicy::CachePolicy ( )

Creates an empty cache policy.

Definition at line 25 of file cachepolicy.cpp.

◆ CachePolicy() [2/2]

CachePolicy::CachePolicy ( const CachePolicy & other)

Creates a cache policy from an other cache policy.

Definition at line 31 of file cachepolicy.cpp.

◆ ~CachePolicy()

CachePolicy::~CachePolicy ( )

Destroys the cache policy.

Definition at line 36 of file cachepolicy.cpp.

Member Function Documentation

◆ cacheTimeout()

int CachePolicy::cacheTimeout ( ) const
nodiscard

Returns the cache timeout for non-permanently cached parts in minutes; -1 means indefinitely.

Definition at line 75 of file cachepolicy.cpp.

◆ inheritFromParent()

bool CachePolicy::inheritFromParent ( ) const

Returns whether it inherits cache policy from the parent collection.

Definition at line 55 of file cachepolicy.cpp.

◆ intervalCheckTime()

int CachePolicy::intervalCheckTime ( ) const
nodiscard

Returns the interval check time in minutes, -1 for never.

Definition at line 85 of file cachepolicy.cpp.

◆ localParts()

QStringList CachePolicy::localParts ( ) const
nodiscard

Returns the parts to permanently cache locally.

Definition at line 65 of file cachepolicy.cpp.

◆ operator=()

CachePolicy & CachePolicy::operator= ( const CachePolicy & other)

.

Parameters
otherother cache policy

Definition at line 40 of file cachepolicy.cpp.

◆ operator==()

bool Akonadi::CachePolicy::operator== ( const CachePolicy & other) const
nodiscard
Parameters
otherother cache policy

Definition at line 46 of file cachepolicy.cpp.

◆ setCacheTimeout()

void CachePolicy::setCacheTimeout ( int timeout)

Sets cache timeout for non-permanently cached parts.

Parameters
timeoutTimeout in minutes, -1 for indefinitely.

Definition at line 80 of file cachepolicy.cpp.

◆ setInheritFromParent()

void CachePolicy::setInheritFromParent ( bool inherit)

Sets whether the cache policy should be inherited from the parent collection.

Definition at line 60 of file cachepolicy.cpp.

◆ setIntervalCheckTime()

void CachePolicy::setIntervalCheckTime ( int time)

Sets interval check time.

Parameters
timeCheck time interval in minutes, -1 for never.

Definition at line 90 of file cachepolicy.cpp.

◆ setLocalParts()

void CachePolicy::setLocalParts ( const QStringList & parts)

Specifies the parts to permanently cache locally.

Definition at line 70 of file cachepolicy.cpp.

◆ setSyncOnDemand()

void CachePolicy::setSyncOnDemand ( bool enable)

Sets whether the collection shall be synced automatically when necessary, i.e.

as soon as it is accessed by a client.

Parameters
enableIf true the collection is synced.

Definition at line 100 of file cachepolicy.cpp.

◆ syncOnDemand()

bool CachePolicy::syncOnDemand ( ) const
nodiscard

Returns whether the collection will be synced automatically when necessary, i.e.

as soon as it is accessed by a client.

Definition at line 95 of file cachepolicy.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.