Design Editor caching strategies
- 3 minutes to read
Design Editor uses a cache to make users' work faster. It stores data that they have accessed recently. Original and edited images, images of text layers, proof images, and product templates are cached.
Caching is carried out in the following way. When a user edits a product, Design Editor caches every design element and the product itself. Also, proof images and hi-res outputs are saved in the cache. When a cache size reaches the limit, then a cleanup process starts. The stored items are sorted by a timestamp. The older elements are, the sooner they are removed from the cache. The hi-res output and proofing URLs never expire, however. If a user wants to obtain a file that was removed from the cache, Design Editor renders it again.
You can control the cache and the cleanup process by setting up cache parameters. You can define them in either FileCache.config file or
Aurigma.DesignAtoms.FileCacheConfiguration section of web.config:
<configuration> <configSections> <section name="Aurigma.DesignAtoms.FileCacheConfiguration" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections> <Aurigma.DesignAtoms.FileCacheConfiguration> ... </Aurigma.DesignAtoms.FileCacheConfiguration> </configuration>
Configuring Cache Parameters
You can set up the cache size and its location. To control the cleanup process, you can set up an interval in seconds between cleanup runs or a cache size that triggers this process.
The following parameters configure the cache:
|Name||Description||Default value||Possible values|
|MaxSize||the maximum size of the cache in bytes||
|CleanUpInterval||interval between cleanup runs, in seconds||
|MaxUtilizationThreshold||maximum cache utilization level (in percent) that triggers automatic cleanup; when the cache size reaches MaxUtilizationThreshold, the cleanup process starts||
|UtilizationTarget||utilization level (in percent) to which the cache should be cleaned up; when the cleanup algorithm reaches the UtilizationTarget level, the cleanup process stops||
|RootPath||the folder where the cache is stored||
For example, let us change the default parameters to run the cleanup once an hour or after reaching the 90 percent level.
<configuration> <configSections> <section name="Aurigma.DesignAtoms.FileCacheConfiguration" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections> <Aurigma.DesignAtoms.FileCacheConfiguration> <!-- 4 GB --> <add key="MaxSize" value="4294967296" /> <!-- An hour --> <add key="CleanUpInterval" value="3600" /> <!-- The 90 percent threshold --> <add key="MaxUtilizationThreshold" value="90" /> <!-- The target level --> <add key="UtilizationTarget" value="70" /> <!-- The cache folder --> <add key="RootPath" value="D:\FileCache" /> </Aurigma.DesignAtoms.FileCacheConfiguration> </configuration>
By setting the path to the
RootPath parameter, you move the cache location to drive D.
Moving Data Folders to Another Location
By default, Design Editor stores the file cache in the
~/App_Data/FileCache folder. You may want to change it using relative or absolute paths:
Relative paths to folders are specified based on your site root and start with
<add key="RootPath" value="~/App_Data/FileCache" />
Complete absolute paths start with a drive letter.
<add key="RootPath" value="D:\FileCache" />
Absolute paths start with
\\for network locations.
<add key="RootPath" value="\\productserver\FileCache" />
When you use absolute paths to external folders, make sure the user account, under which Design Editor runs in ASP.NET/IIS, has the read/write access to the remote folders.
As well as for the cache folder, you can change locations of the public gallery, fonts, and the folder containing user data.
UserDataFolder should be set up in AppSettings, and
FontDirectory is set up in Aurigma.DesignAtoms:
<configuration> <appSettings> <!-- The public gallery folder --> <add key="PublicGalleryFolder" value="C:\PublicGalleryFolder"/> <!-- The folder containing user's templates and images --> <add key="UserDataFolder" value="C:\UserDataFolder"/> </appSettings> <Aurigma.DesignAtoms> <!-- The font folder --> <add key="FontDirectory" value="D:\Fonts" /> </Aurigma.DesignAtoms> </configuration>