|
|
|
@ -27,7 +27,7 @@ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// This is a naive implementation of a cache. A new cache is for each call. For
|
|
|
|
|
// each new key request, the key is first searched in the map and if found. Only
|
|
|
|
|
// each new key request, the key is first searched in the map and if found, the interceptor feeds in the value. Only
|
|
|
|
|
// if the key is not found in the cache do we make a request.
|
|
|
|
|
class CachingInterceptor : public grpc::experimental::Interceptor { |
|
|
|
|
public: |
|
|
|
@ -102,8 +102,10 @@ class CachingInterceptor : public grpc::experimental::Interceptor { |
|
|
|
|
*status = grpc::Status::OK; |
|
|
|
|
} |
|
|
|
|
if (hijack) { |
|
|
|
|
// Hijack is called only once when PRE_SEND_INITIAL_METADATA is present in the hook points
|
|
|
|
|
methods->Hijack(); |
|
|
|
|
} else { |
|
|
|
|
// Proceed is an indicator that the interceptor is done intercepting the batch.
|
|
|
|
|
methods->Proceed(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|