Files
llm-wiki/raw/official-docs/redis-functions-library-deployment.md

12 KiB

title, source_type, url, archive_url, related_branches, related_projects, tags, created
title source_type url archive_url related_branches related_projects tags created
official-doc / Redis Functions — Library Deployment (FUNCTION LOAD, Shebang, no-writes Flag, EVAL 비교) official-doc https://redis.io/docs/latest/develop/programmability/functions-intro/
feature-redis-atomic-program-catalog-contract
ca-skeleton
official-doc
ca-skeleton
caching
redis
2026-07-28

Redis Functions — Library Deployment (FUNCTION LOAD, Shebang, no-writes Flag, EVAL 비교)

Layer: raw/official-docs/ — Redis 공식 문서 ("Redis functions" / functions-intro) 원문 발췌. ca-skeleton feature-redis-atomic-program-catalog-contract 의 "atomic program 기본 배포 모드는 EVAL/EVALSHA script, Redis Functions 는 명시적 opt-in 조건을 만족할 때만" 결정의 근거.

Parent / 활용 branch

Branch 이 자료가 정당화하는 결정
raw/branch-notes/feature-redis-atomic-program-catalog-contract atomic program 의 기본 배포 모드는 EVAL/EVALSHA script 이고, Redis Functions 는 명시적 opt-in 조건(Redis 7.0+ 버전 게이트, cluster 전체 노드 수동 배포 부담, no-writes 류 flag 명시적 선언)을 만족할 때만 채택한다는 결정의 공식 근거

출처

왜 저장했는지

atomic program 카탈로그 branch 에서 EVAL/EVALSHA(기본) 배포 모드와 Redis Functions(opt-in) 배포 모드를 가르는 조건을 정할 때, 공식 문서가 말하는 두 모드의 실질적 차이(스크립트 캐시 vs persistence/replication, 버전 요구사항, library 배포·조회 명령, no-writes flag 의미, cluster 배포 오버헤드)를 그대로 근거로 삼기 위해 저장.

핵심 인용

[§Redis functions (도입부)] "This feature, which became available in Redis 7, supersedes the use of EVAL in prior versions of Redis."

[§Prologue] "To address these needs while avoiding breaking changes to already-established and well-liked ephemeral scripts, Redis v7.0 introduces Redis Functions."

[§Prologue] "By design, Redis only caches the loaded scripts."

[§Prologue] "That means that the script cache can become lost at any time, such as after calling SCRIPT FLUSH, after restarting the server, or when failing over to a replica."

[§Prologue] "The application is responsible for reloading scripts during runtime if any are missing."

[§What are Redis Functions?] "Functions are also persisted to the AOF file and replicated from master to replicas, so they are as durable as the data itself."

[§What are Redis Functions?] "Like all other operations in Redis, the execution of a function is atomic."

[§What are Redis Functions?] "Because running a function blocks the Redis server, functions are meant to finish executing quickly, so you should avoid using long-running functions."

[§Loading libraries and functions] "the library payload must start with Shebang statement that provides a metadata about the library (like the engine to use and the library name)."

[§Loading libraries and functions] "#! name="

[§Loading libraries and functions] "Notice that the FUNCTION LOAD command returns the name of the loaded library, this name can later be used FUNCTION LIST and FUNCTION DELETE."

[§Functions in cluster] "As noted above, Redis automatically handles propagation of loaded functions to replicas."

[§Functions in cluster] "In a Redis Cluster, it is also necessary to load functions to all cluster nodes. This is not handled automatically by Redis Cluster, and needs to be handled by the cluster administrator (like module loading, configuration setting, etc.)."

[§Function flags] "By default, Redis assumes that all functions may perform arbitrary read or write operations. Function Flags make it possible to declare more specific function behavior at the time of registration."

[§Function flags] "In these cases, you can add the no-writes flag to the function's registration, disable the safeguard and allow them to run."

[§Function flags] "For the complete documentation flags, please refer to Script flags."

Claims Extracted

Claim ID Claim (이 자료가 직접 말하는 것) Evidence quote Strength Applies to Does not prove
REDIS-FN-C1 Redis Functions 는 Redis 7(v7.0)에서 도입되었고, 이전 버전의 EVAL 사용을 대체(supersede)한다 [§Redis functions] "became available in Redis 7, supersedes the use of EVAL ... in prior versions" / [§Prologue] "Redis v7.0 introduces Redis Functions" official-vendor-doc Functions 채택의 최소 버전 게이트(7.0+) 판단 6.x 이하에서 FUNCTION LOAD 호출 시 정확한 실패 모드(에러 메시지)는 미서술. ca-skeleton 실제 배포 Redis 버전이 7.0 이상인지는 이 자료로 확인 불가 — 별도 확인 필요
REDIS-FN-C2 EVAL/EVALSHA 스크립트는 서버가 "캐시"로만 취급해 SCRIPT FLUSH·재시작·failover 시 소실될 수 있고 재적재는 애플리케이션 책임인 반면, Functions 는 데이터베이스의 first-class 아티팩트로 AOF persistence + replication 을 통해 데이터와 동일하게 지속(durable)된다 "By design, Redis only caches the loaded scripts." / "script cache can become lost at any time... application is responsible for reloading" / "Functions are also persisted to the AOF file and replicated..." official-vendor-doc EVAL 배포 시 NOSCRIPT 재적재가 왜 애플리케이션 책임인지의 공식 근거; Functions 채택 시 이 부담이 서버 측으로 이전됨을 뒷받침 AOF 가 비활성화된 배포(appendonly no)에서도 이 durability 가 보장되는지는 조건부 서술 없음 — 별도 확인 필요
REDIS-FN-C3 Function library 는 #!<engine name> name=<library name> 형식 Shebang 선언으로 시작해야 하며 최소 1개 이상의 등록된 함수가 필요하다. FUNCTION LOAD 는 라이브러리를 적재하고 이름을 반환하며, 이후 FUNCTION LIST/FUNCTION DELETE 로 조회·삭제한다 "library payload must start with Shebang statement..." / "#! name=" / "FUNCTION LOAD command returns the name... used FUNCTION LIST and FUNCTION DELETE" official-vendor-doc library 이름·엔진 선언 규칙, 배포·조회 명령 카탈로그 구현 가이드 근거 FUNCTION DUMP / FUNCTION RESTORE 명령은 이 문서(functions-intro)에 전혀 등장하지 않는다 — 별도 command reference 확인 없이 이 자료만으로 DUMP/RESTORE 워크플로우를 정당화할 수 없음
REDIS-FN-C4 함수 실행은 원자적이며 실행되는 동안 서버의 모든 활동을 블로킹한다(트랜잭션과 유사한 시맨틱). 따라서 함수는 빠르게 끝나야 하고 long-running 함수는 피해야 한다 "the execution of a function is atomic." / "Because running a function blocks the Redis server, functions are meant to finish executing quickly, so you should avoid using long-running functions." official-vendor-doc bounded-execution(유한 실행, 무한 루프·대량 스캔 금지) 요구의 공식 근거 — EVAL 과 동일한 블로킹 제약을 Functions 도 그대로 가진다는 근거 "빠르게"의 구체적 시간 임계값(ms 단위)은 문서에 없음 — 별도 설정(예: 실행 시간 제한 설정) 문서 확인 필요
REDIS-FN-C5 기본적으로 모든 함수는 read/write 모두 가능하다고 간주되어 read-only replica 에서 실행이 차단된다. 등록 시 no-writes flag 를 명시해야 이 안전장치가 해제되고 FCALL_RO 로 read-only replica 에서 실행 가능해진다. 이 문서는 no-writes 외 flag 의 완전한 목록은 별도 "Script flags" 문서를 참조하라고 안내한다 "Redis assumes that all functions may perform arbitrary read or write operations..." / "you can add the no-writes flag..." / "For the complete documentation flags, please refer to Script flags." official-vendor-doc no-writes flag 의 의미와 등록 API 모양(named-args 변형) allow-oom / no-cluster / allow-stale 등 다른 flag 의 의미는 이 문서에 등장하지 않는다 — 별도 "Lua API — Script flags" 페이지를 raw 로 등록 후에만 인용 가능. 이 claim 만으로 다른 flag 를 정의할 수 없음
REDIS-FN-C6 Redis Cluster 환경에서 함수는 replica 로는 자동 전파되지만, cluster 내 모든(마스터) 노드에 함수를 적재하는 것은 자동화되지 않으며 cluster 관리자가 별도로(module loading·설정 변경과 마찬가지로) 처리해야 한다 "Redis automatically handles propagation of loaded functions to replicas." / "it is also necessary to load functions to all cluster nodes. This is not handled automatically by Redis Cluster, and needs to be handled by the cluster administrator" official-vendor-doc cluster 배포 시 Functions 채택에 따르는 운영 오버헤드 — opt-in 조건 판단 근거 중 하나 EVAL/EVALSHA 스크립트가 cluster 각 노드에 배포될 때 상대적으로 더 쉬운지/어려운지는 이 문서에 비교 서술이 없음 — "Functions 가 EVAL 보다 cluster 배포가 더 번거롭다"는 상대적 결론은 이 자료만으로 내릴 수 없음

Usage Boundaries

  • 적용 가능한 범위:
    • Redis Functions 와 EVAL/EVALSHA 의 지속성(persistence)·복제(replication) 차이를 branch 결정의 공식 근거로 사용
    • Redis 7.0+ 버전 요구사항을 Functions opt-in 조건의 최소 버전 게이트로 사용
    • library Shebang 선언 규칙(#!<engine> name=<library>), FUNCTION LOAD/FUNCTION LIST/FUNCTION DELETE 명령 의미를 구현 가이드에 직접 인용
    • no-writes flag 의 정확한 의미와 등록 API 모양(named-args 변형)을 그대로 인용
    • cluster 배포 시 수동 전파 필요성을 opt-in 조건(cluster 운영 오버헤드) 근거로 사용
  • 적용 금지 (본 자료만으로 정당화 불가):
    • FUNCTION DUMP / FUNCTION RESTORE 명령의 동작 — 이 문서에 없음. 별도 command reference 확인 후 별도 인용 필요
    • allow-oom / no-cluster / allow-staleno-writes 외 flag 의 의미 — 별도 "Lua API — Script flags" 문서 확인 필요
    • "Functions 가 EVAL 보다 항상 낫다"는 식의 일반화된 평가 — 문서는 EVAL 의 한계와 Functions 의 지속성 이점을 서술하지만, Functions 도 "실행 중 서버 전체를 블로킹"하며 "빠르게 끝나야 한다"는 EVAL 과 동일한 제약을 그대로 가진다는 점도 함께 서술한다("항상 우월"이라는 표현은 원문에 없음)
    • ca-skeleton 의 실제 Redis 배포 버전이 7.0 이상인지 여부 — 이 자료는 일반 버전 요구사항만 서술하며, 프로젝트 실제 환경 검증은 별도 확인 필요

메모

  • 이 문서(functions-intro)는 flag 전체 목록을 다루지 않는다 — allow-oom/no-cluster/allow-stale 확인이 필요해지면 Lua API "Script flags" 페이지를 별도 raw/official-docs/로 등록해야 한다.
  • FUNCTION DUMP/FUNCTION RESTORE 확인이 필요해지면 별도 command reference 페이지(redis.io/docs/latest/commands/function-dump, function-restore)를 별도 raw 문서로 등록해야 한다.
  • 같은 branch 근거로 이미 등록된 [[raw/official-docs/redis-eval-scripting-atomicity]] (eval-intro) 와 짝을 이뤄, "EVAL 기본 vs Functions opt-in" 비교의 양쪽 절반을 구성한다.
  • raw/official-docs/redis-eval-scripting-atomicity — 같은 branch 근거, EVAL/Lua 스크립팅 원자성·NOSCRIPT 재적재 쪽 공식 문서 (opt-in 비교의 EVAL 쪽 절반)
  • 같은 주제 다른 official-doc 후보 (미등록): Redis "Lua API — Script flags" 페이지 (no-writes 외 전체 flag 목록), Redis "FUNCTION DUMP"/"FUNCTION RESTORE" command reference
  • 이 자료를 인용한 wiki 요약: (아직 생성 안 됨)