Akonadi

cachecleaner.h
1 /*
2  SPDX-FileCopyrightText: 2007 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef AKONADI_CACHECLEANER_H
8 #define AKONADI_CACHECLEANER_H
9 
10 #include "collectionscheduler.h"
11 
12 #include <QMutex>
13 
14 namespace Akonadi
15 {
16 namespace Server
17 {
18 
19 class Collection;
20 class CacheCleaner;
21 class AkonadiServer;
22 
34 {
35 public:
36  explicit CacheCleanerInhibitor(AkonadiServer &akonadi, bool inhibit = true);
38 
39  void inhibit();
40  void uninhibit();
41 
42 private:
43  Q_DISABLE_COPY(CacheCleanerInhibitor)
44  static QMutex sLock;
45  static int sInhibitCount;
46 
47  CacheCleaner *mCleaner = nullptr;
48  bool mInhibited = false;
49 };
50 
54 class CacheCleaner : public CollectionScheduler
55 {
56  Q_OBJECT
57 
58 public:
63  explicit CacheCleaner(QObject *parent = nullptr);
64  ~CacheCleaner() override;
65 
66 protected:
67  void collectionExpired(const Collection &collection) override;
68  int collectionScheduleInterval(const Collection &collection) override;
69  bool hasChanged(const Collection &collection, const Collection &changed) override;
70  bool shouldScheduleCollection(const Collection &collection) override;
71 
72 private:
73  friend class CacheCleanerInhibitor;
74 
75 };
76 
77 } // namespace Server
78 } // namespace Akonadi
79 
80 #endif
Represents a collection of PIM items.
Definition: collection.h:63
A RAII helper class to temporarily stop the CacheCleaner.
Definition: cachecleaner.h:33
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jul 12 2020 23:16:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.