| 61 | class CryptContext; |
| 62 | |
| 63 | class CaseCache |
| 64 | { |
| 65 | private: |
| 66 | ULONGLONG m_ttl; |
| 67 | unordered_map<wstring, CaseCacheNode *> m_map; |
| 68 | list<CaseCacheNode*> m_lru_list; |
| 69 | |
| 70 | list<CaseCacheNode*> m_spare_node_list; |
| 71 | |
| 72 | CRITICAL_SECTION m_crit; |
| 73 | |
| 74 | long long m_lookups; |
| 75 | long long m_hits; |
| 76 | |
| 77 | public: |
| 78 | CryptContext *m_con; |
| 79 | |
| 80 | private: |
| 81 | void lock(); |
| 82 | void unlock(); |
| 83 | void remove_node(unordered_map<wstring, CaseCacheNode *>::iterator it); |
| 84 | bool check_node_clean(CaseCacheNode *node); |
| 85 | void update_lru(CaseCacheNode *node); |
| 86 | public: |
| 87 | void SetTTL(int nSecs) { m_ttl = (ULONGLONG)nSecs * 1000; }; |
| 88 | |
| 89 | bool store(LPCWSTR dirpath, const list<wstring>& files); |
| 90 | bool store(LPCWSTR dirpath, LPCWSTR file); |
| 91 | bool store(LPCWSTR filepath); |
| 92 | int lookup(LPCWSTR path, wstring& result_path, bool force_not_found = false); |
| 93 | bool remove(LPCWSTR path, LPCWSTR file); |
| 94 | bool remove(LPCWSTR path); |
| 95 | bool purge(LPCWSTR path); |
| 96 | bool rename(LPCWSTR oldpath, LPCWSTR newpath); |
| 97 | long long hits() { long long rval; lock(); rval = m_hits; unlock(); return rval; } |
| 98 | long long lookups() { long long rval; lock(); rval = m_lookups; unlock(); return rval; } |
| 99 | |
| 100 | // used to load dir into cache if there is a miss |
| 101 | bool load_dir(LPCWSTR filepath); |
| 102 | |
| 103 | // disallow copying |
| 104 | CaseCache(CaseCache const&) = delete; |
| 105 | void operator=(CaseCache const&) = delete; |
| 106 | |
| 107 | CaseCache(); |
| 108 | virtual ~CaseCache(); |
| 109 | }; |
| 110 |
nothing calls this directly
no outgoing calls
no test coverage detected