The LEADTOOLS HTML5 Medical Web Viewer Services utilize a caching mechanism to speedup data access for reading DICOM dataset images and information. The default cache implementation is disk caching, using the caching pattern of cache-as-SOR, using the cache as though it were the primary system-of-record. The pattern delegates SOR reading and writing activities to the cache, so that application code is not directly responsible for dealing with cache details.
The caching mechanism is implemented in the Leadtools.Dicom.Imaging assembly. This library is generally only intended for internal use by the LEADTOOLS Medical Web Viewer Web Services. However, the library includes a public interface that allows you to provide a custom caching implementation to replace built-in implementation.
To create your own custom caching implementation, you need to implement the IDataCacheProvider interface, which is defined as:
public interface IDataCacheProvider
{
bool Contains(string id);
void Write<T>(string id, T obj, object options, DateTime? expires);
T Read<T>(string id, object options);
void Remove(string id);
void RemoveAll(string id);
bool IsWritable();
bool IsReadable();
bool IsRemovable();
}
The usage pattern is:
/// create a provider (IDataCacheProvider)
var dataCache = new Leadtools.Dicom.Imaging.DiskDataCacheProvider(new Leadtools.Dicom.Imaging.DiskDataCacheStorage(settings.Storage));
/// pass it to the proxy
var dicomSourceProxy = new DicomSourceProxy(dataCache);
To create your own cache provider, simply implement the IDataCacheProvider interface and pass it to the DicomSourceProxy.
The following is a sample implementation of the IDataCacheProvider interface. This example uses ServiceStack packages to talk to a Redis server. Redis is the one of the most commonly used caching solutions, has a Windows implementation and is easily consumed from .NET (C#) code. In order to use Redis:
Note about the cache item id:
The id used to identify a cached object will always be in the following form:
xxxxxxx/xxxxxxx/xxxxxxx
You can use it as a whole or you may split it into 3 parts, separated by a '/' character.
Products |
Support |
Feedback: Medical Web Viewer Custom Cache |
Introduction |
Help Version 19.0.2017.6.16
|