Caches within LESSTIF serve two main purposes: avoiding unnecessary round-trips to the X server as well as resource sharing. The resource sharing can either occur on the server side (pixmaps, graphics contexts,...) or on the side of the client (images, memory). Caching can also improve performance (although this is at some times only an idle wish...).
When working with caches, very often you need to check a cache for the existence of a particular item. Because the cache may contain many items this lookup has to be fast. In almost every case a simple linked list isn't suitable when you need speed - but (at least) a linked list is easy to code.
As a way out the XContexts of the Xlib come to mind. Unfortunately, they can only be used if you have a display pointer ready at hand. And a XContext is destroyed when the display it belongs to is closed. Therefore the XContexts are neither suitable for all caching purposes nor as a general associative array.