본문으로 건너뛰기

캐시 삭제

캐시 값을 삭제하는 API입니다.

URL 확인

이 API는 service-api.playnanoo.com 도메인을 사용합니다.

API 정보

  • URL: https://service-api.playnanoo.com/cache/v20241201/del
  • Method: PUT
  • 인증 필요: 예

요청 파라미터

파라미터타입필수설명
cache_keystring필수삭제할 캐시 키
DeviceInfo 상속

이 API의 Req 클래스는 DeviceInfo를 상속받습니다. DeviceInfo의 모든 속성이 자동으로 포함됩니다.

응답 데이터

Res 클래스

필드타입설명
Statusstring처리 상태

Unity C# 구현

using System;
using System.Collections;
using UnityEngine.Networking;

public class CacheDel
{
static string path = "https://service-api.playnanoo.com/cache/v20241201/del";

[Serializable]
public class Req : DeviceInfo
{
public string cache_key;

public IEnumerator Send(string cache_key, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(cache_key)) this.cache_key = cache_key;

yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}

[Serializable]
public class Res : BaseResponse
{
public string Status;
}
}

사용 예제

public void DeleteCache()
{
CacheDel.Req req = new CacheDel.Req();

StartCoroutine(req.Send(
cache_key: "player_temp_data",
onSuccess: res =>
{
Debug.Log($"Cache deleted: {res.Status}");
},
onError: (error) =>
{
Debug.LogError($"Del 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}