1. A method for performing caching in an image-processing system, comprising: receiving a filtering query for resources in a cache; returning a subcache in response to the filtering query, wherein the subcache is a new subcache descending from the cache in tree of caches to which the cache and the subcache belong, and wherein returning the subcache comprises adding the new subcache to the tree of caches; and upon receiving a resource query for resources in the subcache, performing the filtering query on the cache, populating the subcache with addresses of resources returned by the filtering query until the resource query is satisfied, and returning available resources from the subcache in response to the resource query.