aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/kvcache.h
blob: ce4fb1d362831e47cd7f99833e2620a96a8edcde (plain) (blame)
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
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include <zencore/httpserver.h>

#include "cachestore.h"
#include "upstream/jupiter.h"

namespace zen {

/**
 * Generic HTTP K/V cache - can be consumed via legacy DDC interfaces, with
 * no key format conventions. Values are blobs
 */

class HttpKvCacheService : public zen::HttpService
{
public:
	HttpKvCacheService();
	~HttpKvCacheService();

	virtual const char* BaseUri() const override;
	virtual void		HandleRequest(zen::HttpServerRequest& Request) override;
	void				Flush();

private:
	MemoryCacheStore		 m_cache;
	FileCacheStore			 m_cache_{"E:\\Local-DDC-Write", "E:\\Local-DDC" /* Read */};
	RefPtr<CloudCacheClient> m_Cloud;
	uint64_t				 m_InMemoryBlobSizeThreshold = 16384;
	uint64_t				 m_FileBlobSizeThreshold	 = 16 * 1024 * 1024;

	struct AccessTracker;

	std::unique_ptr<AccessTracker> m_AccessTracker;
};

}  // namespace zen