Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
I want to use @ngneat/cashew with interceptor for cache HTTP request does it possible?

Please read the instruction of @ngneat/cashew before answering this question from here @ngneat/cashew

The Idea is simple instead of doing this in service level like this,

this.httpClient.get<Posts>(`http://localhost:3000/posts/${id}`,{context:withCache()});

I want to make a global interceptor. Here is my code snippet,

# Config of Interceptor
{
      provide: HTTP_INTERCEPTORS, useClass: CacheInterceptor, multi: true
 }

# Here is CacheInterceptor 

intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
    const modifiedRequest = request.clone(
      {context: withCache()}
    );
    return next.handle(modifiedRequest);
  }

I want to do this because adding { context : withCache() } in every service's method is repetitive, otherwise in a existing project it it too much time killer. That's why I want achive this via making a custom Interceptor. Does it possible to achieve ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!