2525#include " pool/pool.hxx"
2626#include " net/SocketAddress.hxx"
2727#include " io/Logger.hxx"
28+ #include " util/djb_hash.hxx"
2829#include " util/SpanCast.hxx"
2930#include " util/UnalignedBigEndian.hxx"
3031#include " AllocatorPtr.hxx"
@@ -68,7 +69,8 @@ BpInstance::HandleTcacheInvalidate(std::span<const std::byte> payload) noexcept
6869}
6970
7071inline void
71- BpInstance::OnExpireTcacheRA (const ResourceAddress &address) noexcept
72+ BpInstance::OnExpireTcacheRA (const ResourceAddress &address,
73+ Event::TimePoint time) noexcept
7274{
7375 switch (address.type ) {
7476 case ResourceAddress::Type::NONE:
@@ -85,8 +87,7 @@ BpInstance::OnExpireTcacheRA(const ResourceAddress &address) noexcept
8587 const TempPoolLease tpool;
8688 const auto key = lhttp.GetChildId (*tpool);
8789
88- // TODO implement randomized delay
89- lhttp_stock->FadeKey (key);
90+ lhttp_stock->ExpireKey (key, time);
9091 }
9192
9293 break ;
@@ -97,8 +98,7 @@ BpInstance::OnExpireTcacheRA(const ResourceAddress &address) noexcept
9798 const TempPoolLease tpool;
9899 const auto key = cgi.GetChildId (*tpool);
99100
100- // TODO implement randomized delay
101- fcgi_stock->FadeKey (key);
101+ fcgi_stock->ExpireKey (key, time);
102102 }
103103 }
104104
@@ -111,16 +111,14 @@ BpInstance::OnExpireTcacheRA(const ResourceAddress &address) noexcept
111111 const TempPoolLease tpool;
112112 const auto key = cgi.GetChildId (*tpool);
113113
114- // TODO implement randomized delay
115- was_stock->FadeKey (key);
114+ was_stock->ExpireKey (key, time);
116115 }
117116 } else if (cgi.address_list .empty ()) {
118117 if (multi_was_stock) {
119118 const TempPoolLease tpool;
120119 const auto key = cgi.GetChildId (*tpool);
121120
122- // TODO implement randomized delay
123- multi_was_stock->FadeKey (key);
121+ multi_was_stock->ExpireKey (key, time);
124122 }
125123 }
126124#endif // HAVE_LIBWAS
@@ -129,12 +127,12 @@ BpInstance::OnExpireTcacheRA(const ResourceAddress &address) noexcept
129127}
130128
131129inline void
132- BpInstance::OnExpireTcache (const TranslateResponse &response) noexcept
130+ BpInstance::OnExpireTcache (const TranslateResponse &response, Event::TimePoint time ) noexcept
133131{
134- OnExpireTcacheRA (response.address );
132+ OnExpireTcacheRA (response.address , time );
135133
136134 for (const auto &view : response.views ) {
137- OnExpireTcacheRA (view.address );
135+ OnExpireTcacheRA (view.address , time );
138136
139137 for (const auto &transformation : view.transformations ) {
140138 switch (transformation.type ) {
@@ -144,7 +142,7 @@ BpInstance::OnExpireTcache(const TranslateResponse &response) noexcept
144142 break ;
145143
146144 case Transformation::Type::FILTER:
147- OnExpireTcacheRA (transformation.u .filter .address );
145+ OnExpireTcacheRA (transformation.u .filter .address , time );
148146 break ;
149147 }
150148 }
0 commit comments