Cache subscriptions for a short amout of time

Every time you publish a message, it will query the subscription storage for endpoints to send to. This will generate a lot of sql queries in a high throughput scenario. Considering that subscriptions rarely change (only when you install/uninstall endpoints), quering the subscription storage for every message does not make much sense, IMHO.

I've implemented a very simple cache mechanism that optionally will cache these subscriptions for a configured amount of time. Setting expiration time to just 1 second can make quite a big performance boost if you have a lot of messages.

I made some very basic performance test:

No cache:
NumberOfMessages: 5000,0 (#)
PublishTimeNoTx: 2933,5 (msg/s)
PublishTimeWithTx: 4427,8 (msg/s)

Cache set to 1 second:
NumberOfMessages: 5000,0 (#)
PublishTimeNoTx: 6083,3 (msg/s)
PublishTimeWithTx: 22741,5 (msg/s)