Contextual Image Delivery Administration API
Use the CID Administration API to retrieve caching statistics and to remove items from the image transformation caches. By default, the on-disk cache will only be filled after reaching the maximum number of in-memory cache entries. When this happens, by default, all on-disk cache entries and the least recently used in-memory cache entries are persisted. You can change this default behavior through configuration.
Creating a CID caching statistics object
Use the CID administrator class to get a statistics object which can access all the methods and properties described below.
- Java
-
import com.sdl.context.image.api.admin.ContextualImageDeliveryAdministrator; import com.sdl.context.commons.api.caching; ... @Autowired private ContextualImageDeliveryAdministrator contextualImageDeliveryAdministrator; CacheStatistics statistics = contextualImageDeliveryAdministrator.getStatistics(); - .NET
-
using Tridion.Context.Image.Api.Admin; using Tridion.Context.Commons.Api.Caching ... ICacheStatistics statistics = ContextualImageDeliveryAdministrator.Instance.Statistics;
Caching statistics
| Java method | .NET property | Return type | Method returns... |
|---|---|---|---|
getCacheHitRatio() | CacheHitRatio | double | the cache hit ratio |
getLocalHeapHitCount() | LocalHeapHitCount | long | the numbers of entries returned from in-memory cache. |
getLocalHeapMissCount() | LocalHeapMissCount | long | the numbers of entries that could not be found in in-memory cache. |
getLocalHeapSize() | LocalHeapSize | long | the numbers of entries currently in in-memory cache. |
getLocalDiskHitCount() | LocalDiskHitCount | long | the numbers of entries returned from on-disk cache. |
getLocalDiskMissCount() | LocalDiskMissCount | long | the numbers of entries that could not be found in on-disk cache. |
getLocalDiskSize() | LocalDiskSize | long | the numbers of entries currently in on-disk cache. |
Removing items from the cache
The CID cache stores transformed images and their timestamps. You can remove these cache entries using the following methods.
| Method | Description | Example |
|---|---|---|
removeAll() | Remove all items in the cache | admin.removeAll(); |
remove() |
Remove all items that were transformed from source URLs matching one of the following:
|
Example of each:
|
Instead of a literal string, you can also include one or both of the following wildcard characters in the string:
| Wildcard | Description |
|---|---|
* | Represents any sequence of 0 or more characters except /, the forward slash. |
** | Represents any sequence of 0 or more characters. |