Tags: cache

jQuery Object Cache plugin

by Jack K

The jQuery Object Cache plugin showed up on my radar a few days ago. It's a neat little plugin that would come in handy if you've got some jQuery selectors that you find you're re-using often on a page and would like to toss them into a cache instead of refetching them each time you need them:

http://www.decodeuri.com/2008/11/20/new-jquery-plugin-object-cache

I could see using this on smaller projects, but more than likely we'd end up using it on larger projects where a page has a lot of dynamic activity going on in the browser. Usually we just set a local var using something like:

var $listItems = $('#list li');

and then we reuse the $listItems var, but Object Cache would allow us to stuff the results of the selector into a cache, so we wouldn't have to grab them from the DOM again.