Added a cache-capacity-mixin

In an attempt to stop ballooning cache sizes, I have added a
cache-capacity-mixin and a hash-table-function-cache-with-capacity.
This will limit the number of cached results and reduce the set by a
given ratio (removing LRU results).

re ADWolf:#1067