Skip to main content

Cache Get

API for retrieving cache values.

URL Confirmation

This API uses the service-api.playnanoo.com domain.

API Information

  • URL: https://service-api.playnanoo.com/cache/v20241201/get
  • Method: PUT
  • Authentication Required: Yes

Request Parameters

ParameterTypeRequiredDescription
cache_keystringRequiredCache key
DeviceInfo Inheritance

The Req class of this API inherits from DeviceInfo. All properties of DeviceInfo are automatically included.

Response Data

Res Class

FieldTypeDescription
keystringCache key
valuestringCache value

Unity C# Implementation

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

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

[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 key;
public string value;
}
}

Usage Example

public void GetCache()
{
CacheGet.Req req = new CacheGet.Req();

StartCoroutine(req.Send(
cache_key: "player_level",
onSuccess: res =>
{
Debug.Log($"Key: {res.key}, Value: {res.value}");
},
onError: (error) =>
{
Debug.LogError($"Get failed: [{error.ErrorCode}] [{error.Message}]");
}
));
}