KDE 4.2 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 define to inherit all properties of the policy of the parent collection (the default) or specify the following values:

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

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

Parameters:

  | enable | If true the collection is synced.

bool syncOnDemand | ( |  | self ) |

Returns whether the collection shall be synced automatically when necessary.