I HAD added 2.3.1 all dependencies of cacheonix still the error of this package import com.cacheonix.examples.cache.file.cache.data.grid.TextFile doesnt resolved .
The class you're using is from an example code snippet. It's not part of those libraries, and since its just an example, it's probably not part of any library.
The exception stack trace tells you exactly what's wrong: Line 231 of ApplicationFileCacheExample attempts to create a StringBuilder with enough capacity to hold the entire file, and the exception message says that you're out of memory.
Like I said, creating the StringBuilder causes your application to run out of memory, probably because the size of the file you're trying to put into the string builder is too large.
So first of all, the thing you're trying to cache is not actually a text file. Then why is the class named TextFile? Secondly, if it's an HTML page, it won't actually contain the images. You have to cache multiple files. Cacheonix might have a cache available that is specialized for caching web pages.