Under the active theme folder, I have a search-autocomplete.php file which uses various WP queries to create smart JSON results delivered via AJAX to a jQuery UI Autocomplete input field. It's not a normal template file (in fact it shouldn't really be in the theme's folder, it could be a plugin), but it loads the needed WP functions with this line:
However, since it doesn't execute the normal hooks a full page executes, it will never be cached by W3TC or Super Cache, which is obviously suboptimal, especially for something that gets requested with almost every keypress on a search field.
Is there any way to manually tell W3TC via its API to cache this JSON and get it from the cache if appropriate?** Or should I go ahead and code my own caching mini-script for this kind of stuff?