MythTV  master
eitcache.h
Go to the documentation of this file.
1 /* -*- Mode: c++ -*-
2  * Copyright 2006 (C) Stuart Auchterlonie <stuarta at squashedfrog.net>
3  * License: GPL v2
4  */
5 
6 #ifndef EIT_CACHE_H
7 #define EIT_CACHE_H
8 
9 #include <cstdint>
10 
11 // Qt headers
12 #include <QString>
13 #include <QMutex>
14 #include <QMap>
15 
16 // MythTV headers
17 #include "mythtvexp.h"
18 
19 using event_map_t = QMap<uint, uint64_t>;
20 using key_map_t = QMap<uint, event_map_t*>;
21 
22 class EITCache
23 {
24  public:
25  EITCache();
26  ~EITCache();
27 
28  bool IsNewEIT(uint chanid, uint tableid, uint version,
29  uint eventid, uint endtime);
30 
31  uint PruneOldEntries(uint utc_timestamp);
32  void WriteToDB(void);
33 
34  void ResetStatistics(void);
35  QString GetStatistics(void) const;
36 
37  private:
38  event_map_t * LoadChannel(uint chanid);
39  bool WriteChannelToDB(QStringList &value_clauses, uint chanid);
40 
41  // Event key cache
43 
44  mutable QMutex m_eventMapLock;
46 
47  // Cache persistency in database table eit_cache
48  bool m_persistent {true};
49 
50  // Statistics
61 
62  static const uint kVersionMax;
63 
64  public:
65  static MTV_PUBLIC void ClearChannelLocks(void);
66  void SetPersistent(bool persistent) { m_persistent = persistent; }
67 };
68 
69 #endif // EIT_CACHE_H
70 
71 /* vim: set expandtab tabstop=4 shiftwidth=4: */
EITCache::m_pruneCnt
uint m_pruneCnt
Definition: eitcache.h:57
EITCache::ClearChannelLocks
static MTV_PUBLIC void ClearChannelLocks(void)
Removes old channel locks, use it only at master backend start.
Definition: eitcache.cpp:463
EITCache::m_verChgCnt
uint m_verChgCnt
Definition: eitcache.h:54
mythtvexp.h
EITCache::m_channelMap
key_map_t m_channelMap
Definition: eitcache.h:42
EITCache::m_wrongChannelHitCnt
uint m_wrongChannelHitCnt
Definition: eitcache.h:60
EITCache::WriteToDB
void WriteToDB(void)
Definition: eitcache.cpp:328
EITCache::m_persistent
bool m_persistent
Definition: eitcache.h:48
EITCache::m_hitCnt
uint m_hitCnt
Definition: eitcache.h:52
EITCache::EITCache
EITCache()
Definition: eitcache.cpp:22
EITCache::m_tblChgCnt
uint m_tblChgCnt
Definition: eitcache.h:53
key_map_t
QMap< uint, event_map_t * > key_map_t
Definition: eitcache.h:20
EITCache::GetStatistics
QString GetStatistics(void) const
Definition: eitcache.cpp:47
EITCache::PruneOldEntries
uint PruneOldEntries(uint utc_timestamp)
Prunes entries that describe events ending before timestamp time.
Definition: eitcache.cpp:435
uint
unsigned int uint
Definition: compat.h:81
EITCache::ResetStatistics
void ResetStatistics(void)
Definition: eitcache.cpp:33
EITCache::m_accessCnt
uint m_accessCnt
Definition: eitcache.h:51
EITCache::m_futureHitCnt
uint m_futureHitCnt
Definition: eitcache.h:59
EITCache::m_lastPruneTime
uint m_lastPruneTime
Definition: eitcache.h:45
EITCache::IsNewEIT
bool IsNewEIT(uint chanid, uint tableid, uint version, uint eventid, uint endtime)
Definition: eitcache.cpp:360
EITCache::m_eventMapLock
QMutex m_eventMapLock
Definition: eitcache.h:44
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
EITCache::WriteChannelToDB
bool WriteChannelToDB(QStringList &value_clauses, uint chanid)
Definition: eitcache.cpp:261
EITCache::kVersionMax
static const uint kVersionMax
Definition: eitcache.h:62
EITCache::m_entryCnt
uint m_entryCnt
Definition: eitcache.h:56
event_map_t
QMap< uint, uint64_t > event_map_t
Definition: eitcache.h:19
EITCache::~EITCache
~EITCache()
Definition: eitcache.cpp:28
EITCache::m_endChgCnt
uint m_endChgCnt
Definition: eitcache.h:55
EITCache::SetPersistent
void SetPersistent(bool persistent)
Definition: eitcache.h:66
EITCache::LoadChannel
event_map_t * LoadChannel(uint chanid)
Definition: eitcache.cpp:210
nv_python_libs.bbciplayer.bbciplayer_api.version
string version
Definition: bbciplayer_api.py:77
EITCache
Definition: eitcache.h:22
EITCache::m_prunedHitCnt
uint m_prunedHitCnt
Definition: eitcache.h:58