MAINT: use a structure as cache buckets

makes the code more readable, as suggested by @larsmans