Object-Oriented Programming · Pinterest · Medium
You are working inside an existing project repository. Add a read-through cache in front of the product GET API so that fewer requests reach ProductRepository. The following interface is already defined and can be relied on: Implement (or finish implementing) ProductService.get_product(product_id) so that it behaves as follows: Look in the cache before doing anything else. If the product is found there, return it directly and do not touch ProductRepository. If the cache does…