Cache

Deprecated

The Storm API client for .net has been tag:ed end of life and will be ceased to be updated and supported in roll out tests in an unspecified later date.

All Storm’s API’s moves to open API standards and swagger endpoints and these old clients with dependencies to 3rd party technologies or tools will stop being supported. No specific date in set yet.

The following describes how to set up caching when using the Storm API.

To configure caching add the following to the unity section of your configuration file:

Copy
Copied
<assembly name="Enferno.Public" />
<namespace name="Enferno.Public.Caching" />
 
 <container>
      <register type="ICacheManager" mapTo="CacheManager">
        <lifetime type="singleton" />
        <constructor>
          <param name="caches">
            <array>
            <dependency name="AccessClient" />
            </array>
          </param>
        </constructor>
      </register>
      <register name="AccessClient" type="ICache" mapTo="InMemoryCache">
        <lifetime type="singleton" />
        <constructor>
          <param name="name" value="AccessClient" />
        </constructor>
      </register>
    </container>

The CacheManager can handle multiple caches. Above configuration just adds support for caching to the AccessClient. If one more cache is wanted just add another method section with name=”AddCache” under the ICacheManager registration. And then add a new registration for the new cache, equal to the one named “AccessClient” above.

When using a cache for the AccessClient a cache definition file must be used to define which calls to cache and how. The file must be placed in the App_Data folder of your website and named AccessClient.Cache.xml.

Here’s a sample of that file:

Copy
Copied
<?xml version="1.0" encoding="utf-8"?>
<CacheConfiguration name="AccessClient" duration="300">
  <Item name="ClearBasket" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Id"/>
  <Item name="CreateCustomer" duration="0" redirectformat="Customer{0}" propertypath="Id"/>
  <Item name="DeleteBasketItem" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Id"/>
  <Item name="GetAgreementAccount"/>
  <Item name="GetApplication"/>
  <Item name="GetBasket" redirectformat="Basket{0}" propertypath="Id"/>
  <Item name="GetCheckout" redirectformat="Checkout{0}" propertypath="Basket.Id"/>
  <Item name="GetCustomer" redirectformat="Customer{0}" propertypath="Id"/>
  <Item name="GetCustomerByEmail" redirectformat="Customer{0}" propertypath="Id"/>
  <Item name="GetManufacturer"/>
  <Item name="GetManufacturerByUniqueName"/>
  <Item name="GetNavigationStructure"/>
  <Item name="GetProduct"/>
  <Item name="GetProductByUniqueName"/>
  <Item name="InsertBasketItem" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Id"/>
  <Item name="ListApplicationFlags"/>
  <Item name="ListCategories"/>
  <Item name="ListCategoryItems"/>
  <Item name="ListFlags"/>
  <Item name="ListManufacturersEx"/>
  <Item name="ListNavigationNodesEx"/>
  <Item name="ListParametricInfo" />
  <Item name="ListParametricValues2" />
  <Item name="ListPopularProducts2"/>
  <Item name="ListProductAccessories3"/>
  <Item name="ListProductCrossSell2"/>
  <Item name="ListProductFiltersByNode"/>
  <Item name="ListProductFlags"/>
  <Item name="ListProductItemFilterValuesByNode"/>
  <Item name="ListProductParametrics"/>
  <Item name="ListProducts2"/>
  <Item name="ListProductsByIds2"/>
  <Item name="ListProductsByNode2"/>
  <Item name="ListProductsInFamilies2"/>
  <Item name="ListStores"/>
  <Item name="Login" redirectformat="Customer{0}" propertypath="Id"/>
  <Item name="LoginAgreementAccount"/>
  <Item name="PaymentCancel" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Id"/>
  <Item name="UpdateBasket" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Id"/>
  <Item name="UpdateBasketItem" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Id"/>
  <Item name="UpdateBuyer" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Basket.Id"/>
  <Item name="UpdateCustomer" duration="0" redirectformat="Customer{0}" propertypath="Id"/>
  <Item name="UpdateCustomerDeliveryAddress" duration="0" redirectformat="Customer{0}" propertypath="Id"/>
  <Item name="UpdateDeliveryMethod" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Basket.Id"/>
  <Item name="UpdatePaymentMethod" duration="0" redirectformat="Basket{0};Checkout{0}" propertypath="Basket.Id"/>
</CacheConfiguration>