blob: ac38bdcac894f8eb4c0ab5061ec62ea79cee715a (
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
|
#pragma once
#include <library/cpp/actors/core/actor.h>
#include "http.h"
namespace NHttp {
struct TCachePolicy {
TDuration TimeToExpire;
TDuration TimeToRefresh;
TDuration PaceToRefresh;
bool KeepOnError = false;
bool DiscardCache = false;
TArrayRef<TString> HeadersToCacheKey;
TArrayRef<TString> StatusesToRetry;
ui32 RetriesCount = 0;
TCachePolicy() = default;
};
using TGetCachePolicy = std::function<TCachePolicy(const THttpRequest*)>;
NActors::IActor* CreateHttpCache(const NActors::TActorId& httpProxyId, TGetCachePolicy cachePolicy);
NActors::IActor* CreateOutgoingHttpCache(const NActors::TActorId& httpProxyId, TGetCachePolicy cachePolicy);
NActors::IActor* CreateIncomingHttpCache(const NActors::TActorId& httpProxyId, TGetCachePolicy cachePolicy);
TCachePolicy GetDefaultCachePolicy(const THttpRequest* request, const TCachePolicy& policy = TCachePolicy());
}
|