15 minpresentation

Proxy Types and Implementation

Proxy Types and Implementation

0 / 7 completed

Stacking Proxies

typescript
1// Combine multiple proxy behaviors
2const carrierApi = new CarrierAPI();
3
4let service: ShippingService = carrierApi;
5service = new CachingProxy(service, 60000); // Cache for 1 min
6service = new RateLimitingProxy(service, 100); // 100 req/sec
7service = new LoggingProxy(service, logger); // Log all calls
8service = new AuthProxy(service, authService); // Check permissions
9
10// Client uses the stack transparently
11const rates = await service.getRates(request);
Step 1 of 7
← → NavigateSpace: Skip / NextEnter: Next