Free Support Forum - groupdocs.com

Very big size of the Cache folder (+30 GB)


#1

Hello,


I have two questions related to the Cache:

1 - What is the relationship between the original document size and the cache generated for the same? (in percent aprroximately).

2 - We observed that in some cases the “Processing” folder weights more than 10 GB (aprox. 600 documents opened, total cache folder + 30 GB). This folder is not temporary? I mean, once the document is converted, the pages included in that folder are moved to the “Cache” folder, so after converting this folder will be empty?

Thank you.

Alexis.

#2

Hello Alexis,

1. Unfortunately our developers don’t know the exact relationship in percent between document size and generated cache size, because this relationship is not strict, it is varying and depends on different factors.

2.1. When the document is rendered (converting to the HTML-compatible form), all cache is located inside the “Processing” folder, it is like a temporary storage. When rendering is completed, all requested cache is moved to the “Cache” folder. If you are using the image-based mode, only full-size images are staying in the “Processing” folder. When, in the next time, when someone requested the same document with another width, these full-size images are used to create a smaller images.
2.2. Let’s imagine the next situation. You are opening a new document in the image-based mode from scratch. GroupDocs.Viewer creates a “Processing” and a “Cache” folder inside the “temp” folder. When document is opened, “Processing” contains only full-sized page images, and “Cache” contains all other. Then you completely remove the “Processing” folder in order to free disk space. Then you open the same previous document. If the GroupDocs.Viewer widget contains the same width parameters, which were at the previous time, GroupDocs.Viewer will use existing images from the “Cache” folder, and the “Processing” will not be recreated. However, if client-side requires page images with the size (width), which is not available in the “Cache” folder, then GroupDocs.Viewer will create a “Processing” folder with full-sized images, create a smaller images with required size and will move them to the “Cache” folder.

Hope this answer was helpful. If you will have more questions please feel free to contact us.


#3

Hello Denis, thank you for your explanations.


I have attached you an screenshot, this happens every time I open the same document. It’s that correct?

#4

Hello Alexis,

From the screenshot we see two things:
1. You are using streams.
2. GroupDocs.Viewer re-generate new cache every time when you open the document.

In order to determine the correctness of the GroupDocs.Viewer, please provide us the source code of the GroupDocs.Viewer widget. Not even the full source code, but only one line of code, where the “Stream” method is invoked. And we will try to reproduce it.

Thanks and waiting for your reply.


#5

Hello Denis,


I have changed my code from:

Stream(New System.Net.WebClient().OpenRead(WebVisores.VisorGroupDocs.AbrirArchivo()),
WebVisores.VisorGroupDocs.ObtenerDocumentoConVersion(),
WebVisores.VisorGroupDocs.ObtenerExtension(),
WebVisores.VisorGroupDocs.ObtenerNombreDocumento()).

to:

Stream(Nothing,
WebVisores.VisorGroupDocs.ObtenerDocumentoConVersion(),
WebVisores.VisorGroupDocs.ObtenerExtension(),
WebVisores.VisorGroupDocs.ObtenerNombreDocumento(),true, AddressOf ObtenerUrlArchivo).

and now it’s working Ok.

Thank you.

#6

Hello Alexis,

This is how it should be. “Stream” method has the next signature:
Stream(Stream stream,


string fileName = null, string fileExtension = null, string fileDisplayName = null,


bool useCachedStreamContentsIfPossible = false, Func streamCreator = null)
Take a look at the “useCachedStreamContentsIfPossible” parameter - its default value is “false”. So when you omit it, GroupDocs.Viewer doesn’t use cache and re-generate it every time (this is “happening” in the first line of code). In the second line of code, which you have specified, it is “true”, and that’s why old cache is in use now.

All of this is described in the article “How to Use GroupDocs.Viewer with Streams in ASP.NET MVC or WebForms Projects”, sections “Streams and Cache” and “StreamCreator Parameter”.

If you will have more questions please feel free to contact us.