Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Show Page Sections

download

CacheHelper

The CacheHelper function helps you cache data for faster retrievals. The ICacheHelper instance, which is returned when GetCacheHelper() is called, provides you with the following methods:

Methods

void Set<T>(string key, T value, string regionName);
T Get<T>(string key, string regionName);
bool Contains(string key, string regionName);

Example

public class Product2
{
  public string Id {get; set;}
  public string Name { get; set;}
}

Set Data in Cache

var cacheHelper = GetCacheHelper();

Product2 product = new Product2()
{
  Id= "RT001", Name =  "Router"
};
await cacheHelper.Set<Product2>("Product",product);

Console Output

{"Id":"RT001","Name":"Router"}

Get Data from Cache

var cacheHelper = GetCacheHelper();
var logHelper = GetLogHelper();
		 
var productFromCache = await cacheHelper.Get<Product2>("Product");
logHelper.LogDebug(productFromCache);

Console Output

{"Id":"RT001","Name":"Router"}