{
  "id": 7717058,
  "title": "Swapping implementations from the command line",
  "url": "https://urgent.news/2026/09/16/swapping-implementations-from-the-command-line",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-16T05:37:29.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mauvilsa/swapping-implementations-from-the-command-line-20oh"
  },
  "original_language": "en",
  "account": "The tool being developed has repeated the same queries repeatedly, with each query yielding six responses based on different magnitude bands, plus one response for the most severe event. Running the tool again after changing the end date by just one day produced five of the six previous answers. This indicates that the client desires a caching mechanism to store the responses temporarily, thus avoiding redundant requests to the catalog. The main challenge in implementing this cache is not writing the code itself, but rather finding an appropriate solution that works across various environments. At the command line, the cache would disappear every time the process ended, so it must be stored on disk. However, in a notebook or web service, an in-memory dictionary would be faster and simpler. The project cannot rely on external libraries like Redis or Memcached, so a local solution is needed. The common approach to providing such a choice at the command line involves using a flag with allowed values, such as --cache-type={none,memory,disk}, along with --cache-path and --cache-ttl. These flags would only have meaning for one of the options and would be ignored for the others. A small block of code would then be required to convert the selected flag into an object that the program can use.",
  "summary": "The tool built over the last four posts asks the catalog the same questions again and again. summary alone is six requests, one per magnitude band plus one for the strongest event. Run it, change the end date by a day, run it again, and five of those six answers were already on your screen a moment ago. So the client wants a cache. The awkward part is not writing one. It is that there is no…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}