---
title: "FileCache Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_AjaxControls_FileCache.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# FileCache Class
 
This class manages the private and public file cache used by the [BitmapViewer](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_AjaxControls_BitmapViewer.htm.md).
 
**Namespace:** [Aurigma.GraphicsMill.AjaxControls](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_AjaxControls.htm.md)
 **Assembly:** Aurigma.GraphicsMill.AjaxControls (in Aurigma.GraphicsMill.AjaxControls.dll)
 
## Syntax
  
```
Public Class FileCache
```
 
```csharp
public class FileCache
```
 
## Remarks
  
This class is used if you need to store your own files in the Graphics Mill cache (e.g. if you add some extra functionality to the web control). Using this class you can generate unique filenames and get both physical and virtual paths to these files. The Graphics Mill cache will take care about these files lifetime, etc.
 
The workflow for using this class is the following:
 
1. Use the [GetInstance()](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_AjaxControls_FileCache_GetInstance.htm.md) method. This static method returns you an instance of the FileCache class.
2. Everytime you need to create a temporary file in the private cache (i.e. the file which should not be sent to the client), use the [GetPrivateTempFileName(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_AjaxControls_FileCache_GetPrivateTempFileName_1_bb3a7a4f.htm.md) method. It will generate the unique file name, append specified extension, and "register" it as a temporary file. To get a temporary file name for the public cache (i.e. the file which will be available for the download), use the [GetPublicTempFileName(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_AjaxControls_FileCache_GetPublicTempFileName_1_bb3a7a4f.htm.md) method.
3. To create the temporary file with the name generated at the previous step, you need to get a full path (including the path to the folder which contains a cache). Methods [GetAbsolutePrivateCachePath(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_AjaxControls_FileCache_GetAbsolutePrivateCachePath_1_bb3a7a4f.htm.md) and [GetAbsolutePublicCachePath(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_AjaxControls_FileCache_GetAbsolutePublicCachePath_1_bb3a7a4f.htm.md) prepend the path to the private and public cache correspondingly. This way you can pass the result string to the [Save(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Bitmap_Save_1_bb3a7a4f.htm.md) method or any other method which creates a file.
4. If you need to convert a path to the temporary file into the URL, use the [GetRelativePublicCachePath(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_AjaxControls_FileCache_GetRelativePublicCachePath_1_bb3a7a4f.htm.md) method. It will prepend the virtual path to the specified filename.
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - Aurigma.GraphicsMill.AjaxControls.FileCache
 
## Thread Safety
 Static members of this type are safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.
 
## Object Model

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill.AjaxControls_ObjectModel_1.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_AjaxControls_FileCache.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill.AjaxControls_ObjectModel_2.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_AjaxControls_FileCache.htm.md)
  
## See Also

### Reference

- [FileCache Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_AjaxControls_FileCache.htm.md)
- [Aurigma.GraphicsMill.AjaxControls Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_AjaxControls.htm.md)
