캐시

캐시

캐시에 대한 속성 및 메서드가 포함된 클래스를 나타냅니다.


건설자

# 새 캐시()

행동 양식

# (비동기) 더하다(키, 항목, writeThruOptions) → {캐시 항목 버전}

캐시에 CacheItem을 추가합니다. 또한 WriteThruOptions를 지정할 수 있습니다. CacheItem을 사용하여 만료 및 우선 순위와 같은 캐시 항목의 속성을 지정할 수도 있습니다.

매개 변수 :
성함 타입 태만 상품 설명
key

캐시 항목을 식별하는 고유 키입니다.

item 캐시 아이템

CacheItem은 캐시에 저장됩니다.

writeThruOptions 쓰기 옵션 null로

데이터 소스 업데이트에 관한 WriteThruOptins. WriteThru, WriteBehind 또는 None일 수 있습니다.

반환 :
타입
캐시 항목 버전
const ncache  = require('ncache-client');

let cache = await ncache.CacheManager.getCache("test-Cache"); 

await cache.add('key', new ncache.CacheItem("Value"));

const cacheValue = await cache.get('key', ncache.JsonDataType.Scaler);

await cache.close();

# (비동기) 대량 추가(항목, writeThruOptions) → {지도. }

CacheItem이 있는 캐시 키 맵을 WriteThruOptions를 사용하여 캐시에 추가합니다. CacheItem에는 만료, 종속성 및 제거 정보와 같이 항목과 연결할 속성이 포함되어 있습니다.

매개 변수 :
성함 타입 태만 상품 설명
items 지도. 캐시 아이템>

키 및 CacheItem의 사전. 키는 고유해야 합니다.

writeThruOptions 쓰기 옵션 null로

데이터 소스 업데이트에 관한 WriteThruOptions. WriteThru, WriteBehind 또는 None일 수 있습니다.

반환 :

캐시에 저장할 수 없는 예외와 함께 키 사전.

타입
지도.
//The following example demonstrates how to add items to the cache with an absolute expiration 2 minutes from now, a priority of high, 
//and that notifies the application when the item is removed from the cache.

let cache = await ncache.CacheManager.getCache("myCache");
let cacheItems = new Array[2];

let product_1 = new Product();
product_1.Id = 1;
product_1.Name = "Chai";

let product_2 = new Product();
product_2.Id = 2;
product_2.Name = "Chang";


cacheItems[0] = new CacheItem(product_1);
cacheItems[0].setExpiration(new ncache.Expiration(ncache.ExpirationType.Absolute, new ncache.TimeSpan(0, 2, 0)));
cacheItems[0].setPriority(ncache.CacheItemPriority.High);

cacheItems[1] = new CacheItem(product_2);
cacheItems[1].setExpiration(new ncache.Expiration(ncache.ExpirationType.Absolute, new ncache.TimeSpan(0, 2, 0)));
cacheItems[1].setPriority(ncache.CacheItemPriority.Normal);

let map = new Map();
map.set("Product0",cacheItems[0]);
map.set("Product1",cacheItems[1]);
    
let writeThruOptions = new ncache.WriteThruOptions(ncache.WriteMode.WriteThru, "ProdDataSource1");

await cache.addBulk(map, writeThruOptions);

# 선명한()

캐시 지우기

# (비동기) 클리어클라이언트 캐시()

클라이언트 캐시 지우기

# (비동기) 가까운()

캐시 연결을 닫습니다.

# (비동기) 이 포함되어 있습니다(키)

Cache에 키에 대한 CacheItem이 있는지 확인

매개 변수 :
성함 타입 상품 설명
key

캐시에서 찾을 키입니다.

반환 :

참된 캐시에 지정된 키가 있는 요소가 포함된 경우 그렇지 않으면, 그릇된.

//The following example demonstrates how to check for containment of an item in the Cache

let cache = await  ncache.CacheManager.getCache("myCache");

if(await cache.Contains("Product0")){
		Response.Write("Item found!");
}

# (비동기) 포함대량(키)

키에 대한 CacheItems가 캐시에 있는지 확인합니다.

매개 변수 :
성함 타입 상품 설명
keys 반복 가능한 반복자

키 컬렉션입니다.

반환 :

캐시에 있는 각 키의 존재를 확인하기 위한 플래그가 있는 키 사전. 참된 캐시에 지정된 키가 있는 요소가 포함된 경우 그렇지 않으면, 그릇된.

//The following example demonstrates how to check for containment of an item in the Cache.
let cache = await CacheManager.getCache("myCache");

let keys = ["Product0","Product1"];

let result = await cache.ContainsBulk(keys);

# (비동기) 삭제(키, lockHandle, 버전, writeThruOptions)

ICache에서 지정된 항목을 제거합니다. 캐시와 데이터 소스 모두에서 항목을 제거할 수 있도록 쓰기 옵션을 지정할 수도 있습니다. 버전이 지정되면 지정된 버전이 여전히 캐시의 최신 버전인 경우에만 항목이 제거됩니다.

매개 변수 :
성함 타입 상품 설명
key

제거할 항목의 고유 키입니다.

lockHandle 잠금 핸들

항목이 잠겨 있으면 올바른 lockHandle이 지정된 경우에만 제거할 수 있습니다. lockHandle은 처음에 항목을 잠그는 데 사용된 것과 같아야 합니다. 그렇지 않으면 'OperationFailedException'이 발생합니다.

version 캐시 항목 버전

제거할 항목의 버전입니다. 항목이 캐시에서 가장 최신 버전인 경우에만 캐시에서 제거됩니다.

writeThruOptions 쓰기 옵션

데이터 소스 업데이트와 관련된 WriteThruOptions. WriteThru, WriteBehind 또는 None일 수 있습니다.

//Example demonstrates how to delete a locked item in the cache with write through options.
let cache = await ncache.CacheManager.getCache("myCache");

let product = new Product();
product.Id = 1;
product.Name = "Chai";

let key = "Product0";

let version = await cache.add(key, new ncache.CacheItem(product, "FQN.Product"));

let lockHandle = new ncache.LockHandle();

let item = cache.get(key, ncache.JsonDataType.Object, null, null, true, new ncache.TimeSpan(0,0,2), lockHandle);

if (item !== null)
{
    try
    {
        let writeThruOptions = new ncache.WriteThruOptions(ncache.WriteMode.WriteThru, "ProdDataSource1");

        await cache.delete(key, ncache.JsonDataType.Object ,lockHandle, version, writeThruOptions);
    }
    catch (ex)
    {
    ...
    }
}

# (비동기) 대량 삭제(키, writeThruOptions)

캐시에서 지정된 항목을 제거합니다. 캐시와 데이터 소스 모두에서 항목을 제거할 수 있도록 쓰기 옵션을 지정할 수도 있습니다.

매개 변수 :
성함 타입 상품 설명
keys 반복 가능한 반복자

항목을 참조하는 고유 키 목록입니다.

writeThruOptions 쓰기 옵션

데이터 소스 업데이트와 관련된 WriteThruOptions. WriteThru, WriteBehind 또는 None일 수 있습니다.

# (비동기) 얻을(키, classObj, 버전, readThruOptions, acquireLock, lockTimeout, lockHandle)

read-through 캐싱 옵션을 사용할 수 있는 Cache 개체에서 지정된 항목을 검색합니다. read-through 옵션이 설정된 경우 캐시에 존재하지 않는 경우 데이터 소스에서 개체를 가져옵니다. 참조로 CacheItemVersion을 허용합니다. CacheItemVersion에 대해 null이 전달되면 캐시의 개체 버전이 반환됩니다. null이 아닌 CacheItemVersion이 전달되면 해당 개체가 캐시에 있는 개체의 현재 버전인 경우에만 캐시에서 개체가 반환됩니다.

매개 변수 :
성함 타입 상품 설명
key

검색할 캐시 항목의 고유 식별자입니다.

classObj Json 데이터 유형

캐시에서 가져온 값의 유형을 지정합니다.

version 캐시 항목 버전

개체의 버전입니다.

readThruOptions ReadThru 옵션

데이터 소스에서 읽기 위한 ReadThruOptions. ReadThru, ReadThruForced 또는 None일 수 있습니다.

acquireLock 부울

잠금 획득 여부를 결정하는 플래그입니다.

lockTimeout 시간 범위

잠금이 자동으로 해제된 후의 TimeSpan입니다.

lockHandle 잠금 핸들

잠금 정보를 보관할 LockHandle의 인스턴스입니다.

반환 :

검색된 캐시 항목 또는 키를 찾을 수 없는 경우 null 참조입니다.

//Example demonstrates how to retrieve the value cached with read thru option and version
let cache = await ncache.CacheManager.getCache("myCache");

let product = new Product();
product.Id = 1;
product.Name = "Chai";

let key = "Product0";

let version = await cache.add(key, new ncache.CacheItem(product, "FQN.Product"));

let readThruOptions = new ncache.ReadThruOptions(ncache.ReadMode.ReadThru);

let product = await cache.get(key,ncache.JsonDataType.Object, readThruOptions, version);
//Example demonstrates how to retrieve the cached value and acquire a lock at the same time for minutes.
let cache = await ncache.CacheManager.getCache("myCache");

let product = new Product();
product.Id = 1;
product.Name = "Chai";

let key = "Product0";

await cache.add(key, new ncache.CacheItem(product, "FQN.Product"));

let lockHandle = new ncache.LockHandle();
 
let cachedItem = await cache.get(key, ncache.JsonDataType.Object, null, null, true, new ncache.TimeSpan(0, 2, 0),lockHandle);

# (비동기) getBulk(키, classOb, readThruOptions) → {지도. 캐시 아이템>}

키-값 쌍으로 지정된 키에 대해 캐시에서 개체를 검색합니다. 데이터 소스에서 읽기(읽기)에 대한 옵션을 설정할 수 있습니다.

매개 변수 :
성함 타입 태만 상품 설명
keys 반복 가능한 반복자

캐시에서 항목을 가져올 키입니다.

classOb Json 데이터 유형

캐시에서 가져온 값의 유형을 지정합니다.

readThruOptions ReadThru 옵션 null로

데이터 소스에서 읽기 위한 ReadThruOptions. ReadThru, ReadThruForced 또는 None일 수 있습니다.

반환 :

검색된 캐시 항목은 키-값 쌍입니다.

타입
지도. 캐시 아이템>
//Example demonstrates how to retrieve the value cached against multiple keys with Read through Options.
let cache = await ncache.CacheManager.getCache("myCache");

let keys = ["Product0", "Product1", "Product2"]

let readThruOptions = new ncache.ReadThruOptions(ncache.ReadMode.ReadThru);

let items = await cache.getBulk(keys, readThruOptions);

# (비동기) getCacheItem(키, 버전, readThruOptions, acquireLock, lockTimeout, lockHandle) → {캐시 아이템}

read-through 캐싱 옵션을 사용할 수 있는 Cache 개체에서 지정된 항목을 검색합니다. read-through 옵션이 설정된 경우 캐시에 존재하지 않는 경우 데이터 소스에서 개체를 가져옵니다. 참조로 CacheItemVersion을 허용합니다. CacheItemVersion에 대해 null이 전달되면 캐시의 개체 버전이 반환됩니다. null이 아닌 CacheItemVersion이 전달되면 해당 개체가 캐시에 있는 개체의 현재 버전인 경우에만 캐시에서 개체가 반환됩니다.

매개 변수 :
성함 타입 상품 설명
key

검색할 캐시 항목의 고유 식별자입니다.

version 캐시 항목 버전

개체의 CacheItemVersion입니다.

readThruOptions ReadThru 옵션

데이터 소스에서 읽기에 관한 ReadThruOptions. ReadThru, ReadThruForced 또는 None일 수 있습니다.

acquireLock 부울

잠금 획득 여부를 결정하는 플래그입니다.

lockTimeout 시간 범위

잠금이 자동으로 해제된 후의 TimeSpan입니다.

lockHandle 잠금 핸들

잠금 정보를 보관할 LockHandle의 인스턴스입니다.

반환 :

지정된 CacheItem입니다. 키가 없으면 null 참조를 반환합니다.

타입
캐시 아이템
//Example demonstrates how to retrieve cache item with lock handle, timeout and flag box server control.
let cache = await ncache.CacheManager.getCache("myCache");
let key = "Product0";
let lockHandle = new ncache.LockHandle();
let item = cache.getCacheItem(key, null, null, true, TimeSpan.FromSeconds(30), lockHandle);
//Example demonstrates how to retrieve the cache item with read thru option and cache item version.
let cache = await ncache.CacheManager.getCache("myCache");

let product = new Product();
product.Id = 1;
product.Name = "Chai";

let key = "Product0";

let version = await cache.add(key, new ncache.CacheItem(product, "FQN.Product"));

let readThruOptions = new ncache.ReadThruOptions(ncache.ReadMode.ReadThru);

let item = await cache.getCacheItem(key, readThruOptions, version);

# (비동기) getCacheItemBulk(키, readThruOptions)

Cache 개체에서 지정된 CacheItems를 검색합니다. 이 오버로드를 통해 read-through 옵션을 지정할 수도 있습니다. read-through가 설정되고 개체가 캐시에 없으면 개체는 데이터 소스에서 가져와 캐시에 추가됩니다.

매개 변수 :
성함 타입 태만 상품 설명
keys 반복 가능한 반복자

검색할 캐시 항목의 고유 식별자 목록입니다.

readThruOptions ReadThru 옵션 null로

데이터 소스에서 읽기에 관한 ReadThruOptions. ReadThru, ReadThruForced 또는 None일 수 있습니다.

반환 :

지도

//Example demonstrates how to retrieve the cache items with read thru option.
let cache = await ncache.CacheManager.getCache("myCache");

let keys = 
[
    "Product0",
    "Product1",
    "Product2"
]

let readThruOptions = new ncache.ReadThruOptions(ncache.ReadMode.ReadThru);
let items = await cache.getCacheItemBulk(keys, readThruOptions);

# (비동기) getClientInfo() → {클라이언트 정보}

이 클라이언트와 관련된 정보를 표시합니다.

반환 :
타입
클라이언트 정보

# (비동기) getConnected클라이언트 목록() → {배열.클라이언트 정보>}

캐시에 연결된 모든 클라이언트의 정보를 가져옵니다.

반환 :
타입
정렬.클라이언트 정보>

# (비동기) getCount() → {긴}

Cache의 CacheItem 수 얻기

반환 :
타입

# (비동기) getDataStructuresManager() → {데이터 구조 관리자}

{DataStructureManager}의 인스턴스를 반환합니다.

반환 :
타입
데이터 구조 관리자

# (비동기) getIf최신(키, cls, 버전)

최신 버전의 개체가 캐시에 있는 경우에만 캐시에서 개체를 가져옵니다.

매개 변수 :
성함 타입 상품 설명
key

원하는 개체를 참조하는 데 사용되는 고유 키입니다.

cls 클래스 유형

캐시에서 가져온 값의 유형을 지정합니다.

version 캐시 항목 버전

지정된 개체의 버전입니다.

반환 :

캐시에 최신 개체가 있으면 개체가 반환됩니다. 그렇지 않으면 null이 반환됩니다.

//Example demonstrates how to get a newer version of the item from cache if it exists.
let cache =await ncache.CacheManager.getCache("myCache");

let product = new Product();
product.Id = 1;
product.Name = "Chai";

let key = "Product0";

let version = await cache.add(key, new ncache.CacheItem(product, "FQN.Product"));

let product = await cache.getIfNewer(key, ncache.JsonDataType.Object, version);

# (비동기) getIfNewerCache항목(키, 버전) → {캐시 아이템}

최신 버전의 개체가 캐시에 있는 경우에만 캐시에서 CacheItem을 가져옵니다.

매개 변수 :
성함 타입 상품 설명
key

원하는 개체를 참조하는 데 사용되는 고유 키입니다.

version 캐시 항목 버전

지정된 개체의 버전입니다.

반환 :
타입
캐시 아이템

# (비동기) getMessagingService() → {메시징 서비스}

{MessagingService}의 인스턴스를 반환

반환 :
타입
메시징 서비스

# (비동기) getNotificationService() → {알림 서비스}

{NotificationService}의 인스턴스를 반환합니다.

반환 :
타입
알림 서비스

# (비동기) getSearchService() → {검색 서비스}

{SearchService}의 인스턴스를 반환합니다.

반환 :
타입
검색 서비스

# (비동기) 삽입하다(키, 항목, writeThruOptions, lockHandle, releaseLock) → {캐시 항목 버전}

Write-Through 옵션을 지정할 수 있도록 CacheItem을 캐시에 삽입합니다.

매개 변수 :
성함 타입 상품 설명
key

캐시 항목을 식별하는 고유 키입니다.

item 캐시 아이템

캐시에 삽입할 CacheItem입니다.

writeThruOptions 쓰기 옵션

데이터 소스 업데이트에 관한 WriteThruOptins. WriteThru, WriteBehind 또는 None일 수 있습니다.

lockHandle 잠금 핸들

잠금 정보를 보유하는 LockHandle의 인스턴스입니다. 항목이 잠겨 있으면 올바른 lockHandle이 지정된 경우에만 업데이트할 수 있습니다.

releaseLock 부울

작업 수행 후 잠금을 해제해야 하는지 여부를 결정하는 플래그입니다.

반환 :
타입
캐시 항목 버전
const ncache  = require('ncache-client');

let cache = await ncache.CacheManager.getCache("test-Cache"); 

await cache.insert('key', new ncache.CacheItem("Value"));

const cacheValue = await cache.get('key', ncache.JsonDataType.Scaler);

await cache.close();

# (비동기) 대량 삽입(항목, writeThruOptions) → {지도. }

CacheItem이 있는 캐시 키 맵을 WriteThruOptions를 사용하여 캐시에 삽입합니다. CacheItem에는 만료, 종속성 및 제거 정보와 같이 항목과 연결할 속성이 포함되어 있습니다.

매개 변수 :
성함 타입 태만 상품 설명
items 지도. 캐시 아이템>

키 및 CacheItem의 사전. 키는 고유해야 합니다.

writeThruOptions 쓰기 옵션 null로

데이터 소스 업데이트에 관한 WriteThruOptions. WriteThru, WriteBehind 또는 None일 수 있습니다.

반환 :

캐시에 저장할 수 없는 예외와 함께 키의 맵.

타입
지도.
//The following example demonstrates how to insert items to the cache with an absolute expiration 2 minutes from now, a priority of high, 
//and that notifies the application when the item is removed from the cache.

let cache = await ncache.CacheManager.getCache("myCache");
let cacheItems = new Array[2];

let product_1 = new Product();
product_1.Id = 1;
product_1.Name = "Chai";

let product_2 = new Product();
product_2.Id = 2;
product_2.Name = "Chang";


cacheItems[0] = new CacheItem(product_1);
cacheItems[0].setExpiration(new ncache.Expiration(ncache.ExpirationType.Absolute, new ncache.TimeSpan(0, 2, 0)));
cacheItems[0].setPriority(ncache.CacheItemPriority.High);

cacheItems[1] = new CacheItem(product_2);
cacheItems[1].setExpiration(new ncache.Expiration(ncache.ExpirationType.Absolute, new ncache.TimeSpan(0, 2, 0)));
cacheItems[1].setPriority(ncache.CacheItemPriority.Normal);

let map = new Map();
map.set("Product0",cacheItems[0]);
map.set("Product1",cacheItems[1]);
    
let writeThruOptions = new ncache.WriteThruOptions(ncache.WriteMode.WriteThru, "ProdDataSource1");

await cache.insertBulk(map, writeThruOptions);
       

# (비동기) 자물쇠(키, lockTimeout, lockHandle)

캐시의 항목에 대한 잠금을 획득합니다.

매개 변수 :
성함 타입 상품 설명
key

잠글 캐시된 항목의 키입니다.

lockTimeout 시간 범위

잠금이 자동으로 해제된 후 TimeSpan의 인스턴스입니다.

lockHandle 잠금 핸들

잠금이 성공적으로 획득된 경우 잠금 정보로 채워질 LockHandle의 인스턴스입니다.

반환 :

잠금이 성공적으로 획득되었는지 여부.

//Example demonstrates how to lock a cached item.
let key = "Product0";
let lockHandle = new ncache.LockHandle();
let locked = theCache.lock(key, new ncache.TimeSpan(0,0,10), lockHandle);
...

# (비동기) 제거(키, cls, lockHandle, 버전, writeThruOptions) → {캐시 아이템}

ICache에서 지정된 항목을 제거합니다. 캐시와 데이터 소스 모두에서 항목을 제거할 수 있도록 쓰기 옵션을 지정할 수도 있습니다. 버전이 지정되면 지정된 버전이 여전히 캐시의 최신 버전인 경우에만 항목이 제거됩니다.

매개 변수 :
성함 타입 상품 설명
key

제거할 항목의 고유 키입니다.

cls Json 데이터 유형

캐시에서 제거된 값의 유형을 지정합니다.

lockHandle 잠금 핸들

항목이 잠겨 있으면 올바른 lockHandle이 지정된 경우에만 제거할 수 있습니다. lockHandle은 처음에 항목을 잠그는 데 사용된 것과 같아야 합니다. 그렇지 않으면 'OperationFailedException'이 발생합니다.

version 캐시 항목 버전

제거할 항목의 버전입니다. 항목이 캐시에서 가장 최신 버전인 경우에만 캐시에서 제거됩니다.

writeThruOptions 쓰기 옵션

데이터 소스 업데이트와 관련된 WriteThruOptions. WriteThru, WriteBehind 또는 None일 수 있습니다.

반환 :
타입
캐시 아이템
//Example demonstrates how to remove a locked item in the cache with write through options.
let cache = await ncache.CacheManager.getCache("myCache");

let product = new Product();
product.Id = 1;
product.Name = "Chai";

let key = "Product0";

let version = await cache.add(key, new ncache.CacheItem(product, "FQN.Product"));

let lockHandle = new ncache.LockHandle();

let item = cache.get(key, ncache.JsonDataType.Object, null, null, true, new ncache.TimeSpan(0,0,2), lockHandle);

if (item !== null)
{
    try
    {
        let writeThruOptions = new ncache.WriteThruOptions(ncache.WriteMode.WriteThru, "ProdDataSource1");

        await cache.remove(key, ncache.JsonDataType.Object ,lockHandle, version, writeThruOptions);
    }
    catch (ex)
    {
    ...
    }
}

# (비동기) 대량 제거(키, classOb, writeThruOptions)

캐시에서 지정된 항목을 제거합니다. 캐시와 데이터 소스 모두에서 항목을 제거할 수 있도록 쓰기 옵션을 지정할 수도 있습니다.

매개 변수 :
성함 타입 상품 설명
keys 반복 가능한 반복자

항목을 참조하는 고유 키 목록입니다.

classOb Json 데이터 유형

캐시에서 제거된 값의 유형을 지정합니다.

writeThruOptions 쓰기 옵션

데이터 소스 업데이트와 관련된 WriteThruOptions. WriteThru, WriteBehind 또는 None일 수 있습니다.

반환 :

제거된 개체

//The following example demonstrates how you can remove an item from your application's Cache object.
let cache = await ncache.CacheManager.getCache("myCache");

let keys = 
[
    "Product0",
    "Product1",
    "Product2"
];

let writeThruOptions = new ncache.WriteThruOptions(ncache.WriteMode.WriteThru, "ProdDataSource1");

await cache.removeBulk(keys, writeThruOptions);

# toString()

캐시의 이름을 반환

# (비동기) 잠금을 해제(키, 잠금 핸들)

올바른 LockHandle이 지정된 경우 잠긴 캐시 항목의 잠금을 해제합니다. LockHandle이 null인 경우 잠긴 캐시 항목을 강제로 잠금 해제합니다.

매개 변수 :
성함 타입 태만 상품 설명
key

잠금 해제할 캐시된 항목의 키입니다.

lockHandle 잠금 핸들 null로

잠금을 획득할 때 생성되는 LockHandle의 인스턴스입니다.

// Following example demonstrates how to unlock a cached item.
...
let key = "Product0";
...
await cache.Unlock(key, lockHandle);
...

# (비동기) 업데이트 속성(키, 속성)

캐시에 있는 기존 항목의 {CacheItemAttributes}를 업데이트합니다.

매개 변수 :
성함 타입 상품 설명
key

캐시 항목을 식별하는 고유 키입니다.

attributes CacheItem속성

캐시의 항목을 업데이트하기 위한 CacheItemAttributes의 인스턴스입니다.

반환 :

업데이트 작업의 상태를 결정하는 플래그입니다.참된 캐시에 있는 항목의 속성이 성공적으로 업데이트되고 그릇된 작업이 실패한 경우.

// Example demonstrates how to update Absolute Expiration of 5 minutes on an existing item in cache. 

let cache = await ncache.CacheManager.getCache("myCache");

let product = new Product();
product.Id = 1;
product.Name = "Chai";

let key = "Product0";

await cache.insert(key, product);

let attributes = new ncache.CacheItemAttributes();
attributes.setAbsoluteExpiration(new Date().setMinutes(5));

if(await cache.UpdateAttributes(key, attributes)) {
...
}