Agreed, caching would be very tricky.
Have you tried QueueListener for mentioned purpose? URL: http://javadoc.jenkins-ci.org/hudson/model/queue/QueueListener.html . Seems that this extension provides what you want to implement