Akonadi::CachePolicy Class
class Akonadi::CachePolicyRepresents the caching policy for a collection. More...
| Header: | #include <Akonadi/CachePolicy> |
| CMake: | find_package(KPim6 REQUIRED COMPONENTS AkonadiCore)target_link_libraries(mytarget PRIVATE KPim6::AkonadiCore) |
Public Functions
| CachePolicy() | |
| CachePolicy(const Akonadi::CachePolicy &other) | |
| ~CachePolicy() | |
| int | cacheTimeout() const |
| bool | inheritFromParent() const |
| int | intervalCheckTime() const |
| QStringList | localParts() 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
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.
Akonadi::CachePolicy policy; policy.setCacheTimeout( 30 ); policy.setIntervalCheckTime( 20 ); Akonadi::Collection collection = ... collection.setCachePolicy( policy );
\todoDo we also need a size limit for the cache as well? \todo on a POP3 account, is should not be possible to change locally cached parts, find a solution for that
Author: Volker Krause <vkrause@kde.org>
Member Function Documentation
CachePolicy::CachePolicy()
Creates an empty cache policy.
CachePolicy::CachePolicy(const Akonadi::CachePolicy &other)
Creates a cache policy from an other cache policy.
[noexcept] CachePolicy::~CachePolicy()
Destroys the cache policy.
int CachePolicy::cacheTimeout() const
Returns the cache timeout for non-permanently cached parts in minutes; -1 means indefinitely.
Note: Getter function for property cacheTimeout.
See also setCacheTimeout().
bool CachePolicy::inheritFromParent() const
Returns whether it inherits cache policy from the parent collection.
Note: Getter function for property inheritFromParent.
See also setInheritFromParent().
int CachePolicy::intervalCheckTime() const
Returns the interval check time in minutes, -1 for never.
Note: Getter function for property intervalCheckTime.
See also setIntervalCheckTime().
QStringList CachePolicy::localParts() const
Returns the parts to permanently cache locally.
Note: Getter function for property localParts.
See also setLocalParts().
void CachePolicy::setCacheTimeout(int timeout)
Sets cache timeout for non-permanently cached parts. timeout Timeout in minutes, -1 for indefinitely.
Note: Setter function for property cacheTimeout.
See also cacheTimeout().
void CachePolicy::setInheritFromParent(bool inherit)
Sets whether the cache policy should be inherited from the parent collection.
Note: Setter function for property inheritFromParent.
See also inheritFromParent().
void CachePolicy::setIntervalCheckTime(int time)
Sets interval check time. time Check time interval in minutes, -1 for never.
Note: Setter function for property intervalCheckTime.
See also intervalCheckTime().
void CachePolicy::setLocalParts(const QStringList &parts)
Specifies the parts to permanently cache locally.
Note: Setter function for property localParts.
See also localParts().
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. enable If \ true the collection is synced.
Note: Setter function for property syncOnDemand.
See also syncOnDemand().
bool CachePolicy::syncOnDemand() const
Returns whether the collection will be synced automatically when necessary, i.e. as soon as it is accessed by a client.
Note: Getter function for property syncOnDemand.
See also setSyncOnDemand().