AI用語辞典

A comprehensive multilingual AI terminology dictionary

Definition

AIエンジニアリングにおいて、キャッシングは最近または頻繁なクエリ結果、モデル予測、または中間計算を高速メモリ(RAMなど)に保持することでパフォーマンスを最適化します。これにより、高価な…

Summary

キャッシングは、頻繁にアクセスされるデータを一時高速ストレージ層に保存し、レイテンシを削減し、主要なデータソースへの負荷を軽減する技術です。

Key Concepts

Use Cases

Code Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import redis

# Simple caching example
r = redis.Redis(host='localhost', port=6379, db=0)

def get_prediction(model_id, input_data):
    cache_key = f"pred_{model_id}_{hash(str(input_data))}"
    result = r.get(cache_key)
    if result:
        return result.decode('utf-8')
    # Compute if not cached
    prediction = model.predict(input_data)
    r.setex(cache_key, 3600, str(prediction))
    return prediction