diff options
Diffstat (limited to 'zenserver/cache/cachestore.h')
| -rw-r--r-- | zenserver/cache/cachestore.h | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/zenserver/cache/cachestore.h b/zenserver/cache/cachestore.h deleted file mode 100644 index 89c6396b8..000000000 --- a/zenserver/cache/cachestore.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#pragma once - -#include <zencore/IoBuffer.h> -#include <zencore/iohash.h> -#include <zencore/thread.h> -#include <zencore/uid.h> -#include <zenstore/cas.h> -#include <compare> -#include <filesystem> -#include <unordered_map> - -namespace zen { - -class WideStringBuilderBase; -class CasStore; - -} // namespace zen - -struct CacheValue -{ - zen::IoBuffer Value; -}; - -/****************************************************************************** - - /$$ /$$/$$ /$$ /$$$$$$ /$$ - | $$ /$$| $$ | $$ /$$__ $$ | $$ - | $$ /$$/| $$ | $$ | $$ \__/ /$$$$$$ /$$$$$$| $$$$$$$ /$$$$$$ - | $$$$$/ | $$ / $$/ | $$ |____ $$/$$_____| $$__ $$/$$__ $$ - | $$ $$ \ $$ $$/ | $$ /$$$$$$| $$ | $$ \ $| $$$$$$$$ - | $$\ $$ \ $$$/ | $$ $$/$$__ $| $$ | $$ | $| $$_____/ - | $$ \ $$ \ $/ | $$$$$$| $$$$$$| $$$$$$| $$ | $| $$$$$$$ - |__/ \__/ \_/ \______/ \_______/\_______|__/ |__/\_______/ - - Basic Key-Value cache. No restrictions on keys, and values are always opaque - binary blobs. - -******************************************************************************/ - -class CacheStore -{ -public: - virtual bool Get(std::string_view Key, CacheValue& OutValue) = 0; - virtual void Put(std::string_view Key, const CacheValue& Value) = 0; -}; - -/** File system based implementation - - Emulates the behaviour of UE4 with regards to file system structure, - and also adds a file corruption trailer to remain compatible with - the file-system based implementation (this should be made configurable) - - */ -class FileCacheStore : public CacheStore -{ -public: - FileCacheStore(const char* RootDir, const char* ReadRootDir = nullptr); - ~FileCacheStore(); - - virtual bool Get(std::string_view Key, CacheValue& OutValue) override; - virtual void Put(std::string_view Key, const CacheValue& Value) override; - -private: - std::filesystem::path m_RootDir; - std::filesystem::path m_ReadRootDir; - bool m_IsOk = true; - bool m_ReadRootIsValid = false; -}; - -class MemoryCacheStore : public CacheStore -{ -public: - MemoryCacheStore(); - ~MemoryCacheStore(); - - virtual bool Get(std::string_view Key, CacheValue& OutValue) override; - virtual void Put(std::string_view Key, const CacheValue& Value) override; - -private: - zen::RwLock m_Lock; - std::unordered_map<std::string, zen::IoBuffer> m_CacheMap; -}; |