CacheMgr.h 1.1 KB
Newer Older
G
groot 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
////////////////////////////////////////////////////////////////////////////////
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "Cache.h"

namespace zilliz {
namespace vecwise {
namespace cache {

class CacheMgr {
public:
    static CacheMgr& GetInstance() {
        static CacheMgr mgr;
        return mgr;
    }

    size_t ItemCount() const;

    bool IsExists(const std::string& key);

    DataObjPtr GetItem(const std::string& key);

    void InsertItem(const std::string& key, const DataObjPtr& data);
    void InsertItem(const std::string& key, const std::shared_ptr<char>& data, int64_t size);

    void EraseItem(const std::string& key);

    void PrintInfo();

    void ClearCache();

    int64_t CacheUsage() const;
    int64_t CacheCapacity() const;

private:
    CacheMgr();

private:
    CachePtr cache_;
};


}
}
}