#include "CacheManager.h"pthread_once_t CacheManager::_ptht = PTHREAD_ONCE_INIT;CacheManager::CacheManager(){}CacheManager* CacheManager::_pinstance = nullptr;void CacheManager::initCache(size_t num, const string &filename){if(num<0){return;}for (int i = 0; i < num;i++){_cacheList.emplace_back(num);if(filename!=string()){_cacheList[i].readFromFile(filename);}}}LRUCache &CacheManager::getCache(size_t idx){return _cacheList[idx];}//定时更新缓存,将所有的cache的pendinglist的结点依次插入主Cache中void CacheManager::updateAllCaches(){int size = _cacheList.size();LRUCache &Lrucache = _cacheList[0];for (int i = 1; i < size;++i){LRUCache &temp = _cacheList[i];if(temp._keyMap.size()==0){cout << "List NOTHING!" << endl;continue;}Lrucache.mergePending(temp);}for (int i = 1; i < size; ++i){LRUCache &temp = _cacheList[i];temp.update(Lrucache);}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。