Akonadi.CachePolicy

KDE 4.9 PyKDE API Reference

- KDE's Python API

# CachePolicy Class Reference

`from PyKDE4.akonadi import *`

Namespace: Akonadi

## 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).

Synching 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 );

To do: Do we also need a size limit for the cache as well? To do: 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>

## Methods
| __init__ (self)
| __init__ (self, Akonadi.CachePolicy other)
int | cacheTimeout (self)
bool | inheritFromParent (self)
int | intervalCheckTime (self)
QStringList | localParts (self)
bool | operator == (self, Akonadi.CachePolicy other)
| setCacheTimeout (self, int timeout)
| setInheritFromParent (self, bool inherit)
| setIntervalCheckTime (self, int time)
| setLocalParts (self, QStringList parts)
| setSyncOnDemand (self, bool enable)
bool | syncOnDemand (self)

## Method Documentation

__init__ | ( |  | self ) |

Creates an empty cache policy.

__init__ | ( | self, |
|  | Akonadi.CachePolicy | other
| ) |  |  |

Creates a cache policy from an other cache policy.

int cacheTimeout | ( |  | self ) |

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

bool inheritFromParent | ( |  | self ) |

Returns whether it inherits cache policy from the parent collection.

int intervalCheckTime | ( |  | self ) |

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

QStringList localParts | ( |  | self ) |

Returns the parts to permanently cache locally.

bool operator == | ( | self, |
|  | Akonadi.CachePolicy | other
| ) |  |  |

Internal:

setCacheTimeout | ( | self, |
|  | int | timeout
| ) |  |  |

Sets cache timeout for non-permanently cached parts.

Parameters:

  | timeout | Timeout in minutes, -1 for indefinitely.

setInheritFromParent | ( | self, |
|  | bool | inherit
| ) |  |  |

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

setIntervalCheckTime | ( | self, |
|  | int | time
| ) |  |  |

Sets interval check time.

Parameters:

  | time | Check time interval in minutes, -1 for never.

setLocalParts | ( | self, |
|  | QStringList | parts
| ) |  |  |

Specifies the parts to permanently cache locally.

setSyncOnDemand | ( | self, |
|  | bool | enable
| ) |  |  |

Sets whether the collection shall be synced automatically when necessary, i.e. as soon as it is accessed by a client.

Parameters:

  | enable | If true the collection is synced.

bool syncOnDemand | ( |  | self ) |

Returns whether the collection will be synced automatically when necessary, i.e. as soon as it is accessed by a client.