Demo of my strange caching strategy
✓ Published0🌍 Public
Aalex-r-bigelow
Last edited Sep 29, 2016
Created on Sep 29, 2016
This example demonstrates a caching strategy that stores promises instead of resolved data, ensuring that repeated requests for the same resource return the same in-flight promise. The code uses jQuery’s `ajax` method wrapped in a native `Promise` to fetch Star Wars character data from the SWAPI, with a `Cache` class exposing getters for Luke Skywalker and his homeworld, Tatooine. The getter for Tatooine chains off the Luke promise, and the demo logs responses from both cached entries, showing how dependent promises are reused without duplicate network calls.
AI-generated description