-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataAccessPolicy.cpp
executable file
·78 lines (64 loc) · 2.45 KB
/
DataAccessPolicy.cpp
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include"RxStreamer/DataAccessPolicy.h"
namespace Reactor
{
DataAccessPolicy::DataAccessPolicy(
CommandControllerPolicy commandControllerPolicy,
RxData::ObjectHomePolicy cachePolicy,
Policy::Reload reload,
Policy::Attempt attempt,
Policy::Lifespan lifetime,
Policy::LeasePlan leasePlan,
Policy::Interval refreshInterval)
: controllerPolicy_(commandControllerPolicy)
, cachePolicy_(cachePolicy)
, reload_(reload)
, attempt_(attempt)
, lifetime_(lifetime)
, leasePlan_(leasePlan)
, refreshInterval_(refreshInterval)
{ }
Policy::Reload DataAccessPolicy::Reload() const
{
return reload_;
}
Policy::Attempt DataAccessPolicy::attempt() const
{
return attempt_;
}
Policy::Lifespan DataAccessPolicy::lifetime() const
{
return lifetime_;
}
Policy::LeasePlan DataAccessPolicy::leasePlan() const
{
return leasePlan_;
}
Policy::Interval DataAccessPolicy::refreshInterval() const
{
return refreshInterval_;
}
CommandControllerPolicy DataAccessPolicy::ControllerPolicy() const
{
return controllerPolicy_;
}
RxData::ObjectHomePolicy DataAccessPolicy::CachePolicy() const
{
return cachePolicy_;
}
DataAccessPolicy DataAccessPolicy::NoReload(CommandControllerPolicy commandControllerPolicy, RxData::ObjectHomePolicy cachePolicy)
{
return DataAccessPolicy(commandControllerPolicy, cachePolicy, Policy::Reload::No(), Policy::Attempt::NumSuccessfulTimes(1, 1), Policy::Lifespan::Minutes(10), Policy::LeasePlan::NoRenew(), Policy::Interval::RunImmediatelyAndThenEvery(10000));
}
DataAccessPolicy DataAccessPolicy::ReloadOnExpiry(CommandControllerPolicy commandControllerPolicy, RxData::ObjectHomePolicy cachePolicy)
{
return DataAccessPolicy(commandControllerPolicy, cachePolicy, Policy::Reload::OnDelete(), Policy::Attempt::Forever(), Policy::Lifespan::Minutes(10), Policy::LeasePlan::NoRenew(), Policy::Interval::RunImmediatelyAndThenEvery(10000));
}
DataAccessPolicy DataAccessPolicy::ReloadOnModify(CommandControllerPolicy commandControllerPolicy, RxData::ObjectHomePolicy cachePolicy)
{
return DataAccessPolicy(commandControllerPolicy, cachePolicy, Policy::Reload::OnModify(), Policy::Attempt::Forever(), Policy::Lifespan::Minutes(10), Policy::LeasePlan::NoRenew(), Policy::Interval::RunImmediatelyAndThenEvery(10000));
}
DataAccessPolicy DataAccessPolicy::Default()
{
return ReloadOnExpiry(CommandControllerPolicy::Default(), RxData::CacheFactory::Instance().defaultCachePolicy());
}
}