# class CachePolicy

###

Module | akonadi
Namespace | Akonadi
Class | CachePolicy
Inherits |

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

- CachePolicy ( )

  returns ctor

  Creates an empty cache policy.

- CachePolicy (other)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  other | Akonadi.CachePolicy |

  Creates a cache policy from an other cache policy.

- cacheTimeout ( )

  returns int

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

- inheritFromParent ( )

  returns bool

  Returns whether it inherits cache policy from parent collection.

- intervalCheckTime ( )

  returns int

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

- localParts ( )

  returns QStringList

  Returns the parts to permanently cache locally.

- operator == (other)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  other | Akonadi.CachePolicy |

  Internal

- setCacheTimeout (timeout)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  timeout | int |

  Sets cache timeout for non-permanently cached parts.

  timeout - Timeout in minutes, -1 for indefinitely.

- setInheritFromParent (inherit)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  inherit | bool |

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

- setIntervalCheckTime (time)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  time | int |

  Sets interval check time.

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

- setLocalParts (parts)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  parts | QStringList |

  Specifies the parts to permanently cache locally.

- setSyncOnDemand (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  Sets whether the collection shall be synced automatically when necessary.

  enable - If true the collection is synced.

- syncOnDemand ( )

  returns bool

  Returns whether the collection shall be synced automatically when necessary.