MQ caching algorithm