ドキュメント

​
​

Development

User Acquisition

Monetization

産業

Cloud Code

Scripting API

Services C# SDKs

Services JavaScript SDKs

Admin REST API

Client REST API

Scheduler Admin REST API

Observability REST API

Open Unity Dashboard

Cloud Code

このページは選択した言語では使用できません。
LiveOps
​
​
Cloud Code
  • Overview
  • Get started
  • Server authority
  • Cloud Code C# modules
    • Overview
    • Get started
    • Concepts
    • Tutorials
      • Run modules
      • Write modules
      • Development essentials
        • Write unit tests
        • Dependency injection
        • Custom serialization
        • Batch requests
        • In-memory cache
      • Automate deployment
      • Integrate services
      • Advanced configuration
      • Use Cases
    • Reference
  • Cloud Code JavaScript scripts
  • Logging
  • Use-case samples
  • Privacy and consent
  1. Cloud Code

In-memory cache

Cache slow-changing data between C# module endpoints to speed up response times and reduce calls to other services.
読み終わるまでの所要時間 1 分
最終更新 2ヶ月前

You need a fast response time when a client makes a server call. While calling other UGS services in Cloud Code is fast, each request adds latency. For information that doesn't change often, you can introduce a cache to speed up response times. For example, you can cache game configurations stored in Remote Config or Cloud Save.
When a C# module runs on a worker, the worker shares memory between module endpoints. You can create an in-memory cache (Microsoft) to use between these endpoints. This allows your code to load some information from another service, such as Remote Config, into the in-memory cache and use that cache for the next request. This means your code doesn't have to call out to Remote Config again until the cache expires.

Limitations

There are some caveats to using an in-memory cache:
  • There's no guarantee that the module state persists between calls. The deployment of a module, a cold-start after inactivity, or routine maintenance can cause the module to load onto a different worker.
  • Workers can reload for multiple reasons, so don't depend on the data and don't store data that needs to persist long term.
  • Requests from the same user might go to different workers, so don't use in-memory caching to cache player data. This includes caching Remote Config with Game Overrides, unless the Game Override targets all players.
  • A worker has a 256 MB memory limit, so the cache can't hold large amounts of data.

Copyright © 2026 Unity Technologies
法規事項プライバシーポリシークッキーDocumentation Terms of Use私の個人情報を販売または共有しないプライバシーに関する選択 (クッキー設定)

"Unity" の名称、Unity のロゴ、およびその他の Unity の商標は、米国およびその他の国における Unity Technologies またはその関係会社の商標または登録商標です (詳しくはこちら)。その他の名称またはブランドは該当する所有者の商標です。

一部のページは利便性向上のため機械翻訳を使用しており、内容に不正確な表現が含まれる場合があります。内容に齟齬または不一致が生じた場合は、英語版を正本とします。

  • このページ
    • Limitations


このページの問題を報告する