make mapping cache more like a real mapping (search, indices, values),
though performance will be sub-optimal.

also, added a mapping cache with a sliding expiration: accessing a value
will cause its expiration date to be pushed.
catch a null before foreach().