跳转到主要内容

缓存删除

删除缓存值的 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}]");
}
));
}