FileCache Class

This class manages the private and public file cache used by the BitmapViewer.

Namespace: Aurigma.GraphicsMill.AjaxControls
Assembly: Aurigma.GraphicsMill.AjaxControls (in Aurigma.GraphicsMill.AjaxControls.dll)

Syntax

C#
public class FileCache : IFileCache

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()() 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) 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) 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) and GetAbsolutePublicCachePath(String) prepend the path to the private and public cache correspondingly. This way you can pass the result string to the Save(String) 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) method. It will prepend the virtual path to the specified filename.

Inheritance Hierarchy

System..Object
+ Aurigma.GraphicsMill.AjaxControls..FileCache

Thread Safety

Static members of this type are not safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.

See Also

Reference