Pregunta

I have Microsoft Office files which I need to store in Google Guava cache. The key will be fileid and the value will be actual word document. I have that word document in the ByteArrayOutput stream but storing ByteArrayOutput stream is not a good idea. Any other thought ?

¿Fue útil?

Solución

If you really want to cache the binary content you could write the outputstream to a byte array and cache that array, but I would recommend to try the solution from Peter Lawrey first. The only performance penality would be that you need to read the file through the OS, but it is hard to image that, you do so many operations that this would be a problem.

Otros consejos

The OSes disk cache already caches in files in memory that you might like to use later. I would make use of that first. This means all you need to cache is meta data like files name

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top