Next version to http://blogs.msdn.com/b/alex_semi/archive/2011/12/15/increase-cm-cache-and-clean-it.aspx

Now the script goes to WMI, and checks, if each cached package required by any of mandatory assignment, and if it’s in a future, or recurring, it won’t delete.