0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Garnetでevalを使用するためのメモ

Posted at

TL; DR

--lua が必要

はじめに

GarnetはRedis互換を謳うキャッシュストアです。

一方で、互換性が無い部分やデフォルトでは無効化されている機能もあります。
Luaスクリプトによる EVAL コマンドもそのひとつで、デフォルトでは無効化されています。

$ docker run -it --rm -p 6379:6379 ghcr.io/microsoft/garnet:1.0.48
$ redis-cli -p 6379
127.0.0.1:6379> EVAL 1
(error) ERR This instance has Lua scripting support disabled

バージョン

  • Garnet 1.0.48

設定方法

Garnet 起動時に --lua オプションを指定してLuaスクリプトを有効化します。

$ docker run -it --rm -p 6379:6379 ghcr.io/microsoft/garnet:1.0.48 --lua

今度はスクリプトの実行結果が得られました。

127.0.0.1:6379> EVAL "return ARGV[1]" 0 hello
"hello"

なぜ無効化されている?

パフォーマンスの課題があるため、Garnetとしてはextensibilityが推奨されているようです。

Note however, that Lua scripts are slow in general, and if performance and scalability are important, you should instead use our server-side extensibility mechanisms instead.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?